Need Help with DateAdd() (1 Viewer)

woknick

Registered User.
Local time
Today, 11:07
Joined
Sep 25, 2004
Messages
85
I have a table that includes a client account number, revenue, and a Date in the format YYYYMM. I would like to create a query that sums the revenue for a client where the date is six months prior to today.

Thanks in advance
 

odin1701

Registered User.
Local time
Today, 12:07
Joined
Dec 6, 2006
Messages
526
You should create a field that formats the date to MMYYYY format, or not sure this will work.

Criteria for the date field should be:

Bteween DateAdd("m", -6, [datefield]) And Date()
 

WayneRyan

AWF VIP
Local time
Today, 19:07
Joined
Nov 19, 2002
Messages
7,122
woknick,

If your date field [StringDate] is really "formatted" like "YYYYMM" then it is a string.

Make a new Column in your query:

RealDate: cdate(Mid([StringDate], 5,2) & "-" & Mid([StringDate], 7,2) & "-" & Mid([StringDate], 1, 4))

It doesn't have to be a visible.

For Criteria:

Between DateAdd( "m", -6, Date()) And Date()


If [StringDate] is really a Date field then just specify the criteria.

Wayne
 

Users who are viewing this thread

Top Bottom