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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing form parameter to a report query

Status
Not open for further replies.

mikelev

Technical User
Mar 23, 2004
223
US
I have a report "rptCageinv" based on a query "qryCageInvReport", that looks at the "CAGEINVCOUNT" table.

I am trying to pass the Start Date and End Date parameters to the query via a small form "CageInvReportDialog" that contains 2 unbound fields and a Cmdbutton:

txtStartDate
txtEndDate

begin button code
Code:
Private Sub Image20_Click()
DoCmd.close
DoCmd.OpenReport "rptcageinv", acViewPreview, "qrycageinvreport"
End Sub

I added the following to the query criteria under the INSERTDATE column:

Code:
Between nz([Forms]![cageinvreportdialog]![txtstartDATE],#1/1/1900#) And nz([Forms]![cageinvreportdialog]![txtendDATE],#12/31/3000#)

Here are the problems I am having:

1.)After I enter the same value in both txtStartDate and txtEndDate (1/27/2005 9:27:01 AM) I am prompted again by the query for the same information. (i.e Forms!cageinvreportdialog!txtStartDATE and Forms!cageinvreportdialog!txtendDATE)?

2.)The INSERTDATE default on the form is set to now(), but I want to be able to search by date only not date/time?
INSERTDATE value in table = 1/27/2005 9:27:01 AM. I would like to enter 1/27/2005 in txtxStartDate and txtEndDate.

Many thanks for any help you can provide
 
The cageinvreportdialog form must stay open for the query.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thnanks PHV!

Removed the docmd.close and all works well.

What is the proper way to close the "cageinvreportdialog" after the report parameters have been passed and the report is open?


Cheers,
 
Also any way to handle passing just the date as a parameter and not the date/time specified on the record?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top