Create report based on user input

  • Thread starter Thread starter DJ Notion via AccessMonster.com
  • Start date Start date
D

DJ Notion via AccessMonster.com

My question involves the following:

Table: Sales_Leads
Form: Sales_Leads_enter
Report: Sales_Leads_result

I want the user to be able to enter a start and end date in the
'Sales_Leads_enter' form which will query the 'Sales_Leads' table' based on
these date(s) and in turn print the 'Sales_Leads_result' report. Each record
in the Sales_Leads table has a date.

Any help is appreciated.
 
I find that the best way to do this is to have a report that includes all of
the valuesin your table, but to pass the report a criteria to restrict the
rowsource. Keep in mind that if your [Lead_Date] field contains time info,
you will need to modify the strCriteria row below by adding 1 to your
txt_EndDate.

Add a command button to your form if you don't already have one.

Create a subroutine for the Click event of this button that looks something
like:

Private Sub cmd_Report_Click

Dim strCriteria as string

strCriteria = "[Sales_Leads].[Lead_Date] BETWEEN #" _
& Forms!yourFormName.txt_StartDate & "# AND #" _
& Forms!yourFormName.txt_EndDate & "#"
docmd.OpenReport "yourReport", acViewPreview, , strCriteria,acWindowNormal

End Sub

HTH
Dale
 
Thanks Dale. Got it working.

Dale said:
I find that the best way to do this is to have a report that includes all of
the valuesin your table, but to pass the report a criteria to restrict the
rowsource. Keep in mind that if your [Lead_Date] field contains time info,
you will need to modify the strCriteria row below by adding 1 to your
txt_EndDate.

Add a command button to your form if you don't already have one.

Create a subroutine for the Click event of this button that looks something
like:

Private Sub cmd_Report_Click

Dim strCriteria as string

strCriteria = "[Sales_Leads].[Lead_Date] BETWEEN #" _
& Forms!yourFormName.txt_StartDate & "# AND #" _
& Forms!yourFormName.txt_EndDate & "#"
docmd.OpenReport "yourReport", acViewPreview, , strCriteria,acWindowNormal

End Sub

HTH
Dale
My question involves the following:
[quoted text clipped - 8 lines]
Any help is appreciated.
 
i have a table name = Complaints and form name = Complaints
i wanted to generate daily report.. how could i get daily report not over all report in Access 2007

Please reply me Thanks in Anticipation
 
Back
Top