T
TitaniaTiO2
All,
I am trying to use the following statement:
Dim sql As String
Dim sql2 As String
sql = "UPDATE tblPerson " & _
"SET LastName = '" & Me!txtLastName & "', " & _
"FirstName = '" & Me!txtFirstName & "', " & _
"JobTitle = '" & Me!txtJobTitle & "', " & _
"EmploymentStatus = '" & Me!txtNewEmploymentStatus & "', " & _
"WHERE PersonID = " & Me!txtPersonID
Debug.Print sql
CurrentDb.Execute sql, dbFailOnError
sql2 = "UPDATE tblEmployment " & _
"SET DepartmentID = '" & Me!txtDepartmentID & "', " & _
"WHERE PersonID = " & Me!txtPersonID
CurrentDb.Execute sql2, dbFailOnError
DoCmd.Close
I am getting an error "Syntax Error in UPDATE Statement"
It points to the 1st update statement. I am not sure what I am missing.
When I do the debug everything seems to look ok.
tblPerson
PersonID (Key - Autonumber)
LastName (Text)
FirstName (Text)
JobTitle (Text)
EmploymentStatus (text limited to "Existing Employee" Or "Obsolete
Employee")
I am sure it is something small and stupid.
txtNewEmploymentStatus is being updated based on a combo box that limits the
values to match those required in the validation rule.
Thanks!
Titania
I am trying to use the following statement:
Dim sql As String
Dim sql2 As String
sql = "UPDATE tblPerson " & _
"SET LastName = '" & Me!txtLastName & "', " & _
"FirstName = '" & Me!txtFirstName & "', " & _
"JobTitle = '" & Me!txtJobTitle & "', " & _
"EmploymentStatus = '" & Me!txtNewEmploymentStatus & "', " & _
"WHERE PersonID = " & Me!txtPersonID
Debug.Print sql
CurrentDb.Execute sql, dbFailOnError
sql2 = "UPDATE tblEmployment " & _
"SET DepartmentID = '" & Me!txtDepartmentID & "', " & _
"WHERE PersonID = " & Me!txtPersonID
CurrentDb.Execute sql2, dbFailOnError
DoCmd.Close
I am getting an error "Syntax Error in UPDATE Statement"
It points to the 1st update statement. I am not sure what I am missing.
When I do the debug everything seems to look ok.
tblPerson
PersonID (Key - Autonumber)
LastName (Text)
FirstName (Text)
JobTitle (Text)
EmploymentStatus (text limited to "Existing Employee" Or "Obsolete
Employee")
I am sure it is something small and stupid.
txtNewEmploymentStatus is being updated based on a combo box that limits the
values to match those required in the validation rule.
Thanks!
Titania