Print date from form into report

A

Anna

How to print the two dates in report which i input from the form.

Private Sub cmd_prntrpt_Click()
DoCmd.OpenReport "rpt_qrywebmail2", acViewPreview
end sub

Query
SELECT WM.CRC, Sum(WM.WM_Amt) AS Totamnt
FROM tbl_WebMail AS WM
WHERE (((WM.WM_Date) Between [Forms]![frmWeb_Mailfilter]![txtdate1] And
[Forms]![frmWeb_Mailfilter]![txtdate2])) OR
((([Forms]![frmWeb_Mailfilter]![txtdate1]) Is Null)) OR
((([Forms]![frmWeb_Mailfilter]![txtdate2]) Is Null))
GROUP BY WM.CRC
HAVING (((WM.CRC)=[Forms]![frmWeb_Mailfilter]![ddlcrc])) OR
((([Forms]![frmWeb_Mailfilter]![ddlcrc]) Is Null));

Thank You.
 
K

Klatuu

Make the control source of the text box you want to print the date in
Forms!NameOfForm!NameOfControl

The form will have to remain open while the report is be created for this to
work.
 

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

Similar Threads

Blank Report 1
Query 3
Prompt to enter date again 5
View All Records CMD button error 3
Need to add date sorting to form 5
Debit Card Purchases 0
Parameterize Report 1
Date parameters for report 3

Top