Database Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesDatabase Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old October 29th, 2004, 08:48 AM
randall randall is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 15 randall User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
where condition in vba

Dear all, i'm trying to set up a mail merge that is executed from a form in access 2000.i have a checkbox on a form which avtivates a macro and launches the merge using the code below, i copied from microsoft. This works fine, only ALL my records from the database merge to word instead of only ONE.
basically i want to add this where condition to visual basic:
[project_number]=[Forms]![Transport]![project_number] And [shipment_number]=[Forms]![Transport]![shipment_number]
anybody knows?????

Function MergeIt()
Dim objWord As Word.Document
Set objWord = GetObject("C:\Documents and Settings\Randall\My Documents\HouZi5\HouZi5_DPBank.doc", "Word.Document")
' Make Word visible.
objWord.Application.Visible = True
' Set the mail merge data source as the Northwind database.
objWord.MailMerge.OpenDataSource _
Name:="C:\Documents and Settings\Randall\My Documents\HouZi5\HouZi5.mdb", _
LinkToSource:=True, _
Connection:="QUERY BankDoc", _
SQLStatement:="SELECT * FROM [BankDoc]"
' Execute the mail merge.
objWord.MailMerge.Execute
End Function

Reply With Quote
  #2  
Old October 29th, 2004, 08:00 PM
michlmann michlmann is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 56 michlmann User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
try this
Code:
     SQLStatement:="SELECT * FROM [BankDoc] WHERE " & _
    	"[project_number]=[Forms]![Transport]![project_number]" & _
 	" AND " & _
 	"[shipment_number]=[Forms]![Transport]![shipment_number]"
     

Reply With Quote
  #3  
Old October 30th, 2004, 09:29 AM
randall randall is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 15 randall User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
thnx for the reply,

but it still doesn't work, i've tried the code in different versions,
but no luck, so i'm still stuck on this!!!!!!

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesDatabase Development > where condition in vba


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway