Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Probelm with Access query

Status
Not open for further replies.

brandondaly

IS-IT--Management
Jan 9, 2002
194
GB
I'm trying to produce a catalog table in Word, which is being populated from an access database.
I've been using the code below to bring back the data for
SubName S15.

ActiveDocument.MailMerge.DataSource.QueryString = _
"SELECT * FROM [query_tx] WHERE (([SubName]= 's15' ))" & ""


However I have been having trouble change the code to accept a varible (subnm) in place of the 's15' I've tried the code below to no avail.


ActiveDocument.MailMerge.DataSource.QueryString = _
"SELECT * FROM [query_tx] WHERE (([SubName]= "'" & subnm "'" ))" & ""


Can anybody help me correct the code?


Many Thanks
Brandon.


 
Extra quotes are messing things up:

"SELECT * FROM [query_tx] WHERE (([SubName]= '" & subnm & "'))"

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top