Syntax Error

D

DS

I hope I didn't post this twice. If I did just ignore, I received a strange
error that the other one didn't go through.

I'm getting a syntax error here, any help appreciated.
Thanks
DS

CurrentDb.Execute "UPDATE
[;DATABASE=C:\ProServ\Utility\DataSafe.mdb;].tblEmps, " & _
"SET tblEmps.EmpFirstName = " & Chr(34) &
Forms!frmBSEmployees!TxtFirstName & Chr(34) & "," & _
"tblEmps.EmpLastName = " & Chr(34) &
Forms!frmBSEmployees!TxtLastName & Chr(34) & ", " & _
"tblEmps.EmpActive = Forms!frmBSEmployees!ChkActive " & _
"WHERE tblEmps.EmpID = Forms!frmBSEmployees!TxtEmployeeID;"
 
D

DS

I tried cleaning this up, but still get error 3044
CurrentDb.Execute "UPDATE
[;DATABASE=C:\ProServ\Utility\DataSafe.mdb;].tblEmps " & _
"SET tblEmps.EmpFirstName = Forms!frmBSEmployees!TxtFirstName,"
& _
"tblEmps.EmpLastName = Forms!frmBSEmployees!TxtLastName, " & _
"tblEmps.EmpActive = Forms!frmBSEmployees!ChkActive " & _
"WHERE tblEmps.EmpID = Forms!frmBSEmployees!TxtEmployeeID;"
Thanks
DS
 
D

DS

I tried a comma after the first line, I get 3061 too few parameters 4
expected.
CurrentDb.Execute "UPDATE
[;DATABASE=C:\ProServ\Utility\DataSafe.mdb;].tblEmps, " & _
"SET tblEmps.EmpFirstName = Forms!frmBSEmployees!TxtFirstName,"
& _
"tblEmps.EmpLastName = Forms!frmBSEmployees!TxtLastName, " & _
"tblEmps.EmpActive = Forms!frmBSEmployees!ChkActive " & _
"WHERE tblEmps.EmpID = Forms!frmBSEmployees!TxtEmployeeID;"
Thanks
DS
 
J

John W. Vinson

I hope I didn't post this twice. If I did just ignore, I received a strange
error that the other one didn't go through.

I'm getting a syntax error here, any help appreciated.
Thanks
DS

CurrentDb.Execute "UPDATE
[;DATABASE=C:\ProServ\Utility\DataSafe.mdb;].tblEmps, " & _
"SET tblEmps.EmpFirstName = " & Chr(34) &
Forms!frmBSEmployees!TxtFirstName & Chr(34) & "," & _
"tblEmps.EmpLastName = " & Chr(34) &
Forms!frmBSEmployees!TxtLastName & Chr(34) & ", " & _
"tblEmps.EmpActive = Forms!frmBSEmployees!ChkActive " & _
"WHERE tblEmps.EmpID = Forms!frmBSEmployees!TxtEmployeeID;"

Dim strSQL As String
strSQL = "UPDATE [;DATABASE=C:\ProServ\Utility\DataSafe.mdb;].tblEmps " & _
"SET tblEmps.EmpFirstName = " & Chr(34) & _
Forms!frmBSEmployees!TxtFirstName & Chr(34) & ", " & _
"tblEmps.EmpLastName = " & Chr(34) & _
Forms!frmBSEmployees!TxtLastName & Chr(34) & ", " & _
"tblEmps.EmpActive = " & Forms!frmBSEmployees!ChkActive & _
" WHERE tblEmps.EmpID = Forms!frmBSEmployees!TxtEmployeeID;"
Debug.Print strSQL
CurrentDb.Execute strSQL, dbFailOnError
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top