Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to reference a date field in a query 3

Status
Not open for further replies.

Pampers

Technical User
Apr 7, 2004
1,300
AN
Hi everyone,
I want my query to reference a date value on a form, but I cant get it right. I tried this, but no good:

Code:
"#" & [Forms]![frmInvoice]![frmInvoiceSub1].[Form]![InvoicePeriodFrom] & "#"

Any ideas?

Pampers [afro]
Keeping it simple can be complicated
 
Howdy pampers . . .
Code:
[blue][Forms]![frmInvoice]![frmInvoiceSub1].[Form]![InvoicePeriodFrom][/blue]

Calvin.gif
See Ya! . . . . . .
 
Hi TheAceman1
I tried that too, but it didn't work.

Pampers [afro]
Keeping it simple can be complicated
 
[Forms]![frmInvoice]![frmInvoiceSub1].[InvoicePeriodFrom]
 
Or...

"#" & [Forms]![frmInvoice]![frmInvoiceSub1].Controls("InvoicePeriodFrom").Value & "#
 
Roger That pampers . . . and:
Code:
[blue]"#" & Format([Forms]![frmInvoice]![frmInvoiceSub1].[Form]![InvoicePeriodFrom],"m/d/yy") & "#"[/blue]

Calvin.gif
See Ya! . . . . . .
 
Tnx for the replies all,
I'm gonna try it tommorow at work. I keep you posted.

Pampers [afro]
Keeping it simple can be complicated
 
Hi there,
Tnx for all the suggestions. I did some modifications on the design, and now the straight way of refering works. This is what I put in the criterium field of the query (append query)

Code:
>=[Forms]![frmInvoice]![InvoiceRunFrom] And <=[Forms]![frmInvoice]![InvoiceRunUntill]



Pampers [afro]
Keeping it simple can be complicated
 
You could have also used "Between #" & [forms]![frmInvoice]![InvoiceRunFrom] & "# and #" [forms]![frmInvoice]![InvoiceRunUntil] & "#"

Which would translate at runtime to:

Between #10/1/06# and #10/31/06#

Just another way to skin 'er....


 
Tnx TheWildHare, so thats the way that works :). Is was thinking about it, but then avoided it.

Pampers [afro]
Keeping it simple can be complicated
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top