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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update query problem in VBA - SQL 1

Status
Not open for further replies.

slames

Technical User
Nov 5, 2002
211
GB
Hi

I am having problems using a variable in the docmd.runSQL statement:

DoCmd.RunSQL "update tblJob set jbCurrentlyBilling = 1 from dbo.tblBook INNER JOIN " & _
" dbo.tblJob ON dbo.tblBook.bkISBN = dbo.tblJob.jbISBN where tblJob.jbBillTag = 1 and tblBook.bkClient = " & clientToBill

if I replace the clientToBill variable with a hardcoded value say 'abc' then it executes no problem at all.

The clientToBill variable is set ion the following manner:

Dim clientToBill As String
clientToBill = Me.cboClient.Value

When I go through this line by line the variable is holding the correct value. Is my syntax wrong somewhere?

Can anyone help?

Thanks

Steph
 
Have you tried to replace this:
tblBook.bkClient = " & clientToBill
By this ?
tblBook.bkClient = '" & clientToBill & "'"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Wonderful - thank you very much - works perfectly now1
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top