Update date issue in MS Access

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
 
D

Douglas J. Steele

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)
 

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