By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,221 Members | 1,206 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,221 IT Pros & Developers. It's quick & easy.

Problem with a date query

P: n/a
Jim
I'm having a problem with a date query..im trying to pull customer
data based on a date specified from a form to 3 months prior to the
date specified. So lets say in the form I specified 1/2/2004. I
would need all records with a date in October '03, November '03,
December '03 and January '04. Every thing ive tried hasnt worked and
im getting all types of weird recordsets..

thanks

-Jim
Nov 12 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Jim wrote:
I'm having a problem with a date query..im trying to pull customer
data based on a date specified from a form to 3 months prior to the
date specified. So lets say in the form I specified 1/2/2004. I
would need all records with a date in October '03, November '03,
December '03 and January '04. Every thing ive tried hasnt worked and
im getting all types of weird recordsets..

thanks

-Jim

The SQL for the query should become:

select * from yourtable where yourdate between #10/1/2003# and #2/1/2004#

Date is american format, AFAIK.

The query could look into the form directly; then, its SQL will look like

select * from yourtable where yourdate between
forms!yourform!yourcontrol and dateadd("m",-3,forms!yourform!yourcontrol)
--
Bas Cost Budde
http://www.heuveltop.nl/BasCB

Nov 12 '05 #2

P: n/a
On 3 Feb 2004 08:59:52 -0800, ji********@motorola.com (Jim) wrote:
I'm having a problem with a date query..im trying to pull customer
data based on a date specified from a form to 3 months prior to the
date specified. So lets say in the form I specified 1/2/2004. I
would need all records with a date in October '03, November '03,
December '03 and January '04. Every thing ive tried hasnt worked and
im getting all types of weird recordsets..

thanks

-Jim


As query criteria in the Date Field.

Between DateDiff("m",-3,forms!NameOfForm!NameOfControl) and
forms!NameOfForm!NameOfControl
--
Fred
Please respond only to this newsgroup.
I do not reply to personal email
Nov 12 '05 #3

P: n/a
Jim
fr***@example.invalid wrote in message news:<sb********************************@4ax.com>. ..
On 3 Feb 2004 08:59:52 -0800, ji********@motorola.com (Jim) wrote:
I'm having a problem with a date query..im trying to pull customer
data based on a date specified from a form to 3 months prior to the
date specified. So lets say in the form I specified 1/2/2004. I
would need all records with a date in October '03, November '03,
December '03 and January '04. Every thing ive tried hasnt worked and
im getting all types of weird recordsets..

thanks

-Jim


As query criteria in the Date Field.

Between DateDiff("m",-3,forms!NameOfForm!NameOfControl) and
forms!NameOfForm!NameOfControl


Ok but this query doesnt look like it will give me all the records in january..

-Jim
Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.