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

ACCESS Update Command Not Working

P: 6
Hi

Can someone please tell me why this following UPDATE command doesn't update the DB?
Expand|Select|Wrap|Line Numbers
  1. UPDATE tblTest SET tblTest.Answer1 = '92107933' AND tblTest.Answer2='2006-12-17'
  2. WHERE ID=1;
The Answer1 and Answer2 fields are configured as Text. This update command doesn't work, but this one does.

Expand|Select|Wrap|Line Numbers
  1. UPDATE tblTest SET tblTest.TimeStarted ='16:18:18.2820743' WHERE ID = 1
What am I doing wrong? Is is because I'm trying to set 2 fields in the first query and only 1 in the second query?

Pls Help?

Tanks
Jan 15 '07 #1
Share this Question
Share on Google+
1 Reply


ADezii
Expert 5K+
P: 8,616
Hi

Can someone please tell me why this following UPDATE command doesn't update the DB?
UPDATE tblTest SET tblTest.Answer1 = '92107933' AND tblTest.Answer2='2006-12-17'
WHERE ID=1;

The Answer1 and Answer2 fields are configured as Text. This update command doesn't work, but this one does.

UPDATE tblTest SET tblTest.TimeStarted ='16:18:18.2820743' WHERE ID = 1

What am I doing wrong? Is is because I'm trying to set 2 fields in the first query and only 1 in the second query?

Pls Help?

Tanks
It's simply a matter of Syntax, drop the AND and place a comma between multiple Fields in the Update Statement. Hope this helps.
Expand|Select|Wrap|Line Numbers
  1. Dim MySQL As String
  2.  
  3. MySQL = "UPDATE tblTest SET tblTest.Answer1 = '92107933', tblTest.Answer2 = '2006-12-17' WHERE ((([tblTest].[ID])=1));"
  4.  
  5. DoCmd.RunSQL MySQL
Jan 15 '07 #2

Post your reply

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