update error

  • Thread starter enrico via AccessMonster.com
  • Start date
E

enrico via AccessMonster.com

i have this update code behind my button:

sSql = (" UPDATE tblInterviewer " & _
" SET Lastname = '" & Me.txtELastname & "', " & _
" Firstname = '" & Me.txtEFirstname & "', " & _
" MI = '" & Me.txtEMI & "', " & _
" Position = '" & Me.txtEPosition & "', " & _
" Department = '" & Me.txtEDepartment & "' " & _
" WHERE InterviewerID = '" & Me.txtEClientID & "' ")

Set db = CurrentDb
db.Execute sSql, dbFailOnError
End If

the problem is every time i click the button an error occurs, stating a data
type mismatch in criteria expression. what is the problem basically when this
error occurs?
 
S

Stuart McCall

enrico via AccessMonster.com said:
i have this update code behind my button:

sSql = (" UPDATE tblInterviewer " & _
" SET Lastname = '" & Me.txtELastname & "', " & _
" Firstname = '" & Me.txtEFirstname & "', " & _
" MI = '" & Me.txtEMI & "', " & _
" Position = '" & Me.txtEPosition & "', " & _
" Department = '" & Me.txtEDepartment & "' " & _
" WHERE InterviewerID = '" & Me.txtEClientID & "' ")

Set db = CurrentDb
db.Execute sSql, dbFailOnError
End If

the problem is every time i click the button an error occurs, stating a
data
type mismatch in criteria expression. what is the problem basically when
this
error occurs?

At a guess I'd say that InterviewerID and Me.txtEClientID are numeric values
so you don't need the surrounding quotes. Change the WHERE clause to read:

"WHERE InterviewerID = Me.txtEClientID"
 

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

Similar Threads

dlookup error 7
Audit Trail Code 6
Syntax error on Update 2
Timer event does not fire 1
Update syntax VBA and XML 2
problems on insert statement 3
No current record error 3021 1
Run time error in VBA Code 1

Top