query using form for date range

T

the bp Guy

I am using a form to supply date for report query. I want to use the same
date in three different places. as you see in the SQL the three places for
dates. when I add +5 to the end I get error that its to complex. I take it
off works ok. I can run it without the form using between #01/01/01# and
#01/01/01#+5 and it works
SELECT tblInvoice.Date, tblInvoice.Customer, tblInvoice.[Invoice#],
tblInvoice.Amount, tblInvoice.creditinvoice, tblcreditcard.Gross,
tblcreditcard.Fee, tblcreditcard.Date
FROM tblInvoice LEFT JOIN tblcreditcard ON tblInvoice.Customer =
tblcreditcard.Customer
WHERE (((tblInvoice.Date)=[Forms]![frmstuartreport]![Text0]) AND
((tblInvoice.Customer)="stuart") AND ((tblcreditcard.Date) Between
[Forms]![frmstuartreport]![Text0] And [Forms]![frmstuartreport]![Text0]+5))
ORDER BY tblInvoice.Date, tblcreditcard.Date;
Thanks for your help
 
K

KARL DEWEY

Try this --
((tblcreditcard.Date) Between
[Forms]![frmstuartreport]![Text0] And
CVDate([Forms]![frmstuartreport]![Text0])+5))
 
T

the bp Guy

works great Jus curious what cvdate does

KARL DEWEY said:
Try this --
((tblcreditcard.Date) Between
[Forms]![frmstuartreport]![Text0] And
CVDate([Forms]![frmstuartreport]![Text0])+5))

--
KARL DEWEY
Build a little - Test a little


the bp Guy said:
I am using a form to supply date for report query. I want to use the same
date in three different places. as you see in the SQL the three places for
dates. when I add +5 to the end I get error that its to complex. I take it
off works ok. I can run it without the form using between #01/01/01# and
#01/01/01#+5 and it works
SELECT tblInvoice.Date, tblInvoice.Customer, tblInvoice.[Invoice#],
tblInvoice.Amount, tblInvoice.creditinvoice, tblcreditcard.Gross,
tblcreditcard.Fee, tblcreditcard.Date
FROM tblInvoice LEFT JOIN tblcreditcard ON tblInvoice.Customer =
tblcreditcard.Customer
WHERE (((tblInvoice.Date)=[Forms]![frmstuartreport]![Text0]) AND
((tblInvoice.Customer)="stuart") AND ((tblcreditcard.Date) Between
[Forms]![frmstuartreport]![Text0] And [Forms]![frmstuartreport]![Text0]+5))
ORDER BY tblInvoice.Date, tblcreditcard.Date;
Thanks for your help
 
K

KARL DEWEY

I think of it as Con_Vert_Date

Access interpets your first [Forms]![frmstuartreport]![Text0] string as a
date because it fits the date format and is evaluating a date.

The second is concatenating 5 to the string to appear as '8/28/20085' and
does not increment the date by 5.

--
KARL DEWEY
Build a little - Test a little


the bp Guy said:
works great Jus curious what cvdate does

KARL DEWEY said:
Try this --
((tblcreditcard.Date) Between
[Forms]![frmstuartreport]![Text0] And
CVDate([Forms]![frmstuartreport]![Text0])+5))

--
KARL DEWEY
Build a little - Test a little


the bp Guy said:
I am using a form to supply date for report query. I want to use the same
date in three different places. as you see in the SQL the three places for
dates. when I add +5 to the end I get error that its to complex. I take it
off works ok. I can run it without the form using between #01/01/01# and
#01/01/01#+5 and it works
SELECT tblInvoice.Date, tblInvoice.Customer, tblInvoice.[Invoice#],
tblInvoice.Amount, tblInvoice.creditinvoice, tblcreditcard.Gross,
tblcreditcard.Fee, tblcreditcard.Date
FROM tblInvoice LEFT JOIN tblcreditcard ON tblInvoice.Customer =
tblcreditcard.Customer
WHERE (((tblInvoice.Date)=[Forms]![frmstuartreport]![Text0]) AND
((tblInvoice.Customer)="stuart") AND ((tblcreditcard.Date) Between
[Forms]![frmstuartreport]![Text0] And [Forms]![frmstuartreport]![Text0]+5))
ORDER BY tblInvoice.Date, tblcreditcard.Date;
Thanks for your help
 

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