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

Syntax error

Status
Not open for further replies.

IJOC

Technical User
Jan 27, 2009
24
US
I have a piece of vba code (from Blueclaw) that I use for inventory control. I have used successfully it in the past on a prototype database that I created and all worked fine. Now I am getting an error listed below. The only difference is the that pkTICardID was a number and in the new production database it is text. Could this be the problem if so how can I fix it. I am definitely not a vba programmer. I can follow the code and understand some what. Any help would be great. Thanks -Pat

This is the error:
Run-time error '3075':

This is the code:
Syntax error (missing operator) in query expression
'pkTICardID=1995BBUDCCOLG14'

DoCmd.RunSQL "Update tblTICards set intTICardQQH=intTICardQQH+" & Nz(hold_TIqty, 0) & " where pkTICardID=" & Me.fkTITODCardID
DoCmd.RunSQL "Update tblTICards set intTICardQQH=intTICardQQH-" & Nz(Me.intTITODCardQty, 0) & " where pkTICardID=" & Me.fkTITODCardID
Me.pkTICardNo.Requery
 
Numeric vs text makes a huge difference. Text values must be delimited with quotes. Try:
Code:
DoCmd.RunSQL "Update tblTICards set intTICardQQH=intTICardQQH+" & Nz(hold_TIqty, 0) & " where pkTICardID=""" & Me.fkTITODCardID & """"
DoCmd.RunSQL "Update tblTICards set intTICardQQH=intTICardQQH-" & Nz(Me.intTITODCardQty, 0) & " where pkTICardID=""" & Me.fkTITODCardID & """"

Duane
Hook'D on Access
MS Access MVP
 
Sweet that worked. I really need to find a class on vba. Thanks a bunch!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top