Update date issue in MS Access

  • Thread starter Thread starter gagan
  • Start date Start date
G

gagan

I am new to MS Access, I have a table
table_r with column ar_date
defined as date/time ( general date)

How can i write a update statement to update this date
based on a variable

date ld_date
Update table_r set ar_date = ld_date;

Thanx,
Gagan
 
If you're trying to do this in VBA, you need to create the SQL as:

strSQL = "UPDATE table_r " & _
"SET ar_date = " & Format$(ld_date, "\#mm\/dd\/yyyy\#")

if you're only worried about date, or

strSQL = "UPDATE table_r " & _
"SET ar_date = " & Format$(ld_date, "\#mm\/dd\/yyyy
hh\:nn\:ss\#")

if you want to include time as well.

(the arguments I'm using in the Format statement add the necessary #
delimiters, as well as ensure that the date/time is in the correct format,
regardless of what your Short Date format has been set to)
 
Back
Top