Create report based on user input

  • Thread starter DJ Notion via AccessMonster.com
  • 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.
 
Ad

Advertisements

G

Guest

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
 
D

DJ Notion via AccessMonster.com

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.
 
Ad

Advertisements

Joined
Jul 16, 2013
Messages
1
Reaction score
0
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
 

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