Problem with Update Command in Access

anunat

New member
Local time
Today, 17:37
Joined
Jun 25, 2012
Messages
6
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?
 
As posted elsewhere:

For starters, you're using 2 different variables, unless that's a typo. Second, you have to concatenate the variable, using the appropriate delimiter for date values:

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

Is your table really named 1?
 
Thanks ! That worked...

The two variables was a typo and I did call my table 1.
 
Happy to help, and welcome to the site.
 

Users who are viewing this thread

Back
Top Bottom