Query for yesterday

  • Thread starter Thread starter Jessie
  • Start date Start date
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
 
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
 
Back
Top