Now()+15 help

travismp

Registered User.
Local time
Today, 21:31
Joined
Oct 15, 2001
Messages
386
I have a date field that I run an update query on with this as the update to add 15 days to todays date in a date formatted field.

What can I add to this to format the data for "mm/dd/yyyy" so it leaves the time stamp out?

Now()+15(format"mm/dd/yyyy") or something like this maybe?
 
How about

Format(DateAdd("d",15,Date),"mm/dd/yyyy")


FYI - Use Date when you want just the date and no time. Now includes both.
 
Thank you BobLarson, I know I can always count on you for the goods! You sir are the man. I did not know about DateAdd so that is good to know. :)
 
"Data Type Mismatch in criteria expression"

Format(DateAdd("d",15,"Date"),"mm/dd/yyyy")

Anything else maybe???
 
"Data Type Mismatch in criteria expression"

Format(DateAdd("d",15,"Date"),"mm/dd/yyyy")

Anything else maybe???

Get rid of the quotes around the word DATE. DATE is a function, not a string.
 
I tried. As soon as I leave that field it adds the quotes back. I am using Access 2003 if it matters.
 
If you are using it in a control source or in a query you have to add the parentheses:


Date()
 
Adding the () took care of it. I also now know the difference between Now() and Date() where I did not before. Thank you sir.
 
also a logic question:

Why do this: Format(DateAdd("d",15,Date()),"mm/dd/yyyy")
When you can: Date()+15

Is one better than the other?
 
also a logic question:

Why do this: Format(DateAdd("d",15,Date()),"mm/dd/yyyy")
When you can: Date()+15

Is one better than the other?

Using date add is more explicit and less prone to Access misunderstanding what you want. While the other will work most of the time, DateAdd will work ALL of the time.
 
Perfect. Thank you for all of your help tonight. you have saved me once again. Thanks!
 

Users who are viewing this thread

Back
Top Bottom