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

Update statement problems

P: 273

I'm attempting to update a record via the recordset.update method, However, the recordset object is defined and accesses the correct record that I want to update, as I can retrieve field values from the record.

The open string for the recordset that I'm using should allow changes:

Expand|Select|Wrap|Line Numbers
  1. "Select * from products where productname='"&request("txtname")&"'",ocon1,Adopendynamic,Adlockoptimistic
there is no problem to update statement but when i use with primarykey & it's automatic number using the following code then : (

Expand|Select|Wrap|Line Numbers
  1. "Select * from products where productID='"&request("txtids")&"'",ocon1,Adopendynamic,Adlockoptimistic
Microsoft JET Database Engine (0x80040E07)
Syntax error in date in query expression 'productID="89"

Is there some other "object" that needs to be defined to allow changes to the record, or something else that I am missing that causes this update to fail?

thanks 4 u reply ( Fary )
Jul 5 '09 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 2.5K+
P: 2,545
Hi. Remove the single quotes before and after ProductID in the WHERE clause of your SQL string. You are treating the long-integer autonumber value as a string, causing a type mismatch error on trying to open the recordset filtered to a specific value.

Expand|Select|Wrap|Line Numbers
  1. "Select * from products where productID = " & request ("txtids"), ocon1, Adopendynamic, Adlockoptimistic


ps I have moved your post from our Insights area - which is an articles section - to the answers section where it belongs.
Jul 5 '09 #2

Post your reply

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