Access Problem with Update Command in Access

Joined
Jun 25, 2012
Messages
5
Reaction score
0
I am trying to populate the SaleDate column in my table using the UPDATE command.

Dim mydate As Date
mydate = DateValue("01/" & strmonth & "/" & stryear)
MsgBox ldate (shows date in mm/dd/yyyy format correctly)

When I try to use mydate in the UPDATE statement, I get the error: too few arguments.

CurrentDb().Execute "UPDATE 1 SET [SaleDate] = mydate;"

Can somebody help me with this?

If my method is completely wrong, can you please suggest how I can use a date variable in the UPDATE statement?
 
Joined
Jun 12, 2012
Messages
53
Reaction score
0
Hi, I did not tested it in Access, but my first shot would be adding ' character (I forgot how it's called in my own language, so I can even translate it to English :blush:) at both ends of mydate. That's how I do it in real sql server at least :nod:

"UPDATE 1 SET [SaleDate] = '" & mydate & "';"
 
Joined
Jun 12, 2012
Messages
53
Reaction score
0
Now I've learned something too. Thank you. I generally prefer SQL Server + C# applications than Access, but you never know..., right? ;)
 

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

Top