today - 1

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm trying to force yesterday's date into a query criteria. My goal is to use the output as an external data source for an excel pivot table. Does anyone know how, in Access, I can get yesterday's date? My data is formatted yyyymmdd.

TIA.
 
I'm trying to force yesterday's date into a query criteria. My goal is to use the output as
an external data source for an excel pivot table. Does anyone know
how, in Access, I can get yesterday's date? My data is formatted
yyyymmdd.

Where [DateField] = Date()-1

The actual date format is irrelevant.
 
I'm trying to force yesterday's date into a query criteria. My goal is to use the output as
an external data source for an excel pivot table. Does anyone know
how, in Access, I can get yesterday's date? My data is formatted
yyyymmdd.

Where [DateField] = Date()-1

The actual date format is irrelevant.

I think it is! Dutch date format starts with the day. If an expression
is not calculated into a date somewhere in the background, "-1" will
seldom put you yesterday. I could write today as 290104 (I see that
happen! Yes I do! People act funny!).

I pledge toward using the Date/Time format for a date field anyway.
 
Bas Cost Budde said:
I'm trying to force yesterday's date into a query criteria. My goal is
to use the output as

an external data source for an excel pivot table. Does anyone know
how, in Access, I can get yesterday's date? My data is formatted
yyyymmdd.

Where [DateField] = Date()-1

The actual date format is irrelevant.

I think it is! Dutch date format starts with the day. If an expression
is not calculated into a date somewhere in the background, "-1" will
seldom put you yesterday. I could write today as 290104 (I see that
happen! Yes I do! People act funny!).

I pledge toward using the Date/Time format for a date field anyway.

Date()-1 in Access VBA will always return yesterday's date. If you stuff
that result into a field in a Jet table that is of a Date DataType then
yesterday's date will be stored in that field and the format property is
completely irrelevant. The format property only deals with *display*.

If you stuff that result into a field that is not a Date DataType then yes,
you will get different results, but those results still will not have
anything to do with the format property applied to that field.
 
I'm trying to force yesterday's date into a query criteria. My goal is to use the output as

an external data source for an excel pivot table. Does anyone know
how, in Access, I can get yesterday's date? My data is formatted
yyyymmdd.

Where [DateField] = Date()-1

The actual date format is irrelevant.

I think it is! Dutch date format starts with the day. If an expression
is not calculated into a date somewhere in the background, "-1" will
seldom put you yesterday. I could write today as 290104 (I see that
happen! Yes I do! People act funny!).

I pledge toward using the Date/Time format for a date field anyway.

Actually, in Access, regardless of how the field is formatted, as long
as it is a Date/Time datatype, is stored as a Double. Today is 38015.
So 38015 - 1 = 38014, yesterday.
In a Debug window, type each line with a question mark.
?cdbl(date())
Result 38015
?cdbl(Date()-1)
Result 38014
? CDate(38014)
Result 01/28/2004
 
Back
Top