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

error 3129 invalid sql statement

Status
Not open for further replies.

din2005

Programmer
Mar 22, 2005
162
GB
Hi i have this sql code on frmTransferClinic form and under the command button transfer the code is this

strSQLTransfer = "UPDATE tblPatientClinics SET tblPatientClinics.ClinicDate = txtChooseClinicDate, tblPatientClinics.Consultant = cboConsultant, tblPatientClinics.TransferClinic = chkTransfer, tblPatientClinics.ReasonforCancellation = txtReasonTransfer " & _
"WHERE (((tblPatientClinics.ClinicDate)=[Me]![txtConsultantLst]) AND ((tblPatientClinics.Consultant)=[Me]![txtClinicDatelst]));"

DoCmd.RunSQL strSLQTransfer

but i get an error saying invalid sql statement expected delete, insert, procedure, select and update!

Could u tell me where i have gone wrong!
 
Try
Code:
strSQLTransfer = "UPDATE tblPatientClinics C " & _
"  SET C.ClinicDate = #" & txtChooseClinicDate & "#, " & _
"      C.Consultant = '" & cboConsultant & "', " & _
"      C.TransferClinic = '" & chkTransfer & "', " & _
"      C.ReasonforCancellation = '" & txtReasonTransfer &"' " & _
"WHERE C.ClinicDate=#" & [Me]![txtConsultantLst] & "' " & _
"      AND C.Consultant= '" & [Me]![txtClinicDatelst] & "';"
 
hi i tried your solution and now get an error msg saying

run time error 2465

"Microsoft can't find the field | to in your expression"

strSQLTransfer = "UPDATE tblPatientClinics C " & _
" SET C.ClinicDate = #" & txtChooseClinicDate & "#, " & _
" C.Consultant = '" & cboConsultant & "', " & _
" C.TransferClinic = '" & chkTransfer & "', " & _
" C.ReasonforCancellation = '" & txtReasonTransfer & "' " & _
"WHERE C.ClinicDate=#" & [Me]![txtClinicDatelst] & "# " & _
" AND C.Consultant= '" & [Me]![txtConsultantLst] & "';
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top