|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
try this
Code:
SQLStatement:="SELECT * FROM [BankDoc] WHERE " & _
"[project_number]=[Forms]![Transport]![project_number]" & _
" AND " & _
"[shipment_number]=[Forms]![Transport]![shipment_number]"
|
|
#3
|
|||
|
|||
|
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!!!!!! |
![]() |
| Viewing: Dev Articles Community Forums > Databases > Database Development > where condition in vba |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|