By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,959 Members | 1,136 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,959 IT Pros & Developers. It's quick & easy.

Update Error

P: 31
I am trying to update a record but I keep receiving an error, "Data type mismatch in criteria expression." Here is the code:

Expand|Select|Wrap|Line Numbers
  1.  DoCmd.RunSQL ("Update Caller2 SET Ext = '" & Me!txtExt & "' where CallerID ='" & GlobalCID & "'") 
It has something to do with the where clause. The code "worked" when I forgot to include it. I need to be able to update a bunch of fields, but broke them down one by one to debug, and reached the conclusion it is the where clause. GlobalCID is being assigned properly. The only thing I can think of is CallerID is an autonumber, but I don;t know.

Any help??
May 10 '07 #1
Share this Question
Share on Google+
3 Replies


Rabbit
Expert Mod 10K+
P: 12,347
I am trying to update a record but I keep receiving an error, "Data type mismatch in criteria expression." Here is the code:

Expand|Select|Wrap|Line Numbers
  1.  DoCmd.RunSQL ("Update Caller2 SET Ext = '" & Me!txtExt & "' where CallerID ='" & GlobalCID & "'") 
It has something to do with the where clause. The code "worked" when I forgot to include it. I need to be able to update a bunch of fields, but broke them down one by one to debug, and reached the conclusion it is the where clause. GlobalCID is being assigned properly. The only thing I can think of is CallerID is an autonumber, but I don;t know.

Any help??
If CallerID is a number then you have to leave off those single quotes you're using to enclose it. The single quotes tell the system that it's a string and will treat it as such.
May 10 '07 #2

P: 31
Such a green mistake. Thanks, and sorry for the hassle.
May 10 '07 #3

Rabbit
Expert Mod 10K+
P: 12,347
Such a green mistake. Thanks, and sorry for the hassle.
It's not a problem at all. Good luck.
May 10 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.