• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Syntax Problem

ravikumar00008

New Member
HI,


This is the query i am using to update the records.

But when i am executing,getting sql syntax error.

Please correct the syntax of the query.

[pre]
Code:
sSQL = "UPDATE TblTest " & _
"set [Month] = '" & SplitMonth & "' , [Year] = '" & SplitYear & "' , [Protocol#] = '" & ColA & "'" & _
" [Project Name]= '" & ColB & "' , [Project Coord]= '" & ColC & "' , [Lot#]= '" & ColD & "'" & _
" [Date Rec'd]= '" & ColE & "' , [Date ready to measure]= '" & ColF & "' , [Date Measured]= '" & ColG & "'" & _
" [Qty of Lenses Measured]= '" & ColH & "' , [BC]= '" & ColI & "' , [CT]= '" & ColJ & "'" & _
" [Power]= '" & ColK & "' , [Diameter]= '" & ColL & "' , [Lens Cross Sections]= '" & ColM & "'" & _
" [Qty of Lenses x-sectioned]= '" & ColN & "' , [Others]= '" & ColO & "' , [CompletionDate]= '" & ColP & "'" & _
" [Turn Around Time(# of Days)]= '" & ColQ & "'" & _
" Where [ID]  = '" & SqlID & "'"
[/pre]

Regards

Kumar
 
Hi, ravikumar00008!


Without the TblTest definition (fields and types) and without the variables definition (field, types and values), there's no much that can be done, except for missing commas after fields:

Protocol#, Lot#, [Date Measured], CT, [Lens Cross Sections], CompletionDate


Regards!
 
Hi SirJB7,


Thanks for the help.

yes the lack of commas is the problem.


here is the correct code.

[pre]
Code:
sSQL = "UPDATE TblLabParams " & _
"set [Month] = '" & SplitMonth & "' , [Year] = '" & SplitYear & "' , [Protocol] = '" & ColA & "'" & _
" ,[ProjectName]= '" & ColB & "' , [ProjectCoordinator]= '" & ColC & "' , [Lot]= '" & ColD & "'" & _
" ,[DateRecord]= '" & ColE & "' , [DateReadyToMeasure]= '" & ColF & "' , [DateMeasured]= '" & ColG & "'" & _
" ,[QtyOfLensMeasured]= '" & ColH & "' , [BC]= '" & ColI & "' , [CT]= '" & ColJ & "'" & _
" ,[Power]= '" & ColK & "' , [Diameter]= '" & ColL & "' , [LensCrossSections]= '" & ColM & "'" & _
" ,[QtyOfLensXSectioned]= '" & ColN & "' , [Others]= '" & ColO & "' , [CompletionDate]= '" & ColP & "'" & _
" ,[TurnAroundTime]= '" & ColQ & "'" & _
" Where [ID] = '" & SqlID & "'"
[/pre]
Regards

Kumar
 
Hi, ravikumar00008!

Glad you solved it. Thanks for your feedback and welcome back whenever needed or wanted.

Regards!
 
Back
Top