Query for yesterday

J

Jessie

Hello,

I need to write a query that will pull all records with
yesterday's date in "mm/dd/yy" format.

I can't find the syntax I should use to display yesterday
as the default value of a text box on my form which I then
use in my query. I know I am missing something small. This
is what I have tried, but it is incorrect:

Format((Date(),"mm/dd/yy")-1)

Any help would be appreciated.

Thanks,
Jessie
 
J

John Vinson

Hello,

I need to write a query that will pull all records with
yesterday's date in "mm/dd/yy" format.

I can't find the syntax I should use to display yesterday
as the default value of a text box on my form which I then
use in my query. I know I am missing something small. This
is what I have tried, but it is incorrect:

Format((Date(),"mm/dd/yy")-1)

Any help would be appreciated.

Turn this around. The Format() function returns a text string, and you
can't subtract 1 from a text string - but you can subtract 1 (day)
from a date:

Format(Date() - 1, "mm/dd/yy")

John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 

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