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?
 
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 :o) at both ends of mydate. That's how I do it in real sql server at least :nod:

"UPDATE 1 SET [SaleDate] = '" & mydate & "';"
 
Now I've learned something too. Thank you. I generally prefer SQL Server + C# applications than Access, but you never know..., right? ;)
 
Back
Top