PDA

View Full Version : [SOLVED:] Help updating a Specific Record



gmaxey
01-06-2016, 12:24 PM
I have a database table with 5 fields:

ID
Client
Platform
ProjectManager
ProjectEngineer

I a trying to update a specific fields using the following SQL statement (e.g, the field with the ID value = 13:

modMain.UpdateAccess "Update RigData SET Platform='XXX', ProjectManager=YYY', ProjectEngineer='ZZZ' WHERE ID='13';"

However, when I do I get the following error:

"Data type mismatch in criteria expression"

I think this error is due to the ID fields being an AutoNumber type because if I change the SQL statement as follows it runs without error:

Chevon is a value in the Client column. The problem is that there are several records with Client= "Chevron" and I only want to update the one wit the ID value = 13

'modMain.UpdateAccess "Update RigData SET Platform='XXX', ProjectManager='YYY', ProjectEngineer='ZZZ' WHERE Client='Chevron';"

Can someone please explain how to make this work or offer and alternate method? Thank you.

jonh
01-06-2016, 12:49 PM
AutoNew?

Autonumber is a long integer which is a number. You use quotes for text.


Update RigData SET Platform='XXX', ProjectManager='YYY', ProjectEngineer='ZZZ' WHERE ID=13

gmaxey
01-06-2016, 03:37 PM
Jonh,

Thank you very, very much. I was busting my brain (limited as it may be) over that . Thank you again and I fixed the AutoNew typo.