Print a report from a form where you choose parameters

B

BrookieOU

I have a form that allows a user to choose a Client Group and a pay period
range and it will pull the appropriate billing information for that specific
group and pay period (i.e. Project Team 2/15/09 - 3/15/09 pay period). What
it shows, in datasheet format, is the Consultant Name, Pay Period, Hours
Worked and Hours Billed. What I want to do is be able to print the
corresponding report directly from the form by adding a "print" button to the
header where the parameter choices are.

I want the report to only show the information based on the parameters a
person has entered...any suggestions?

Thanks,
Brooke
 
B

Beetle

Use the WhereCondition argumant of the OpenReport method.
For example;

Private Sub cmdPrint_Click ()

Dim strCriteria As String

strCriteria = "[ClientGroup]=""" & Me!cboClientGroup & _
""" And [PayStart] >=#" & Me!txtPayStart & _
"# And [PayEnd] <=#" & Me!txtPayEnd & "#"

DoCmd.OpenReport "rptYourReport", acViewPreview, , strCriteria

End Sub

The above assumes you have a combo box where you select text
values like "Project Team" and two text boxes where you enter
the beginning and ending dates.
 
B

BrookieOU

That is exactly what I have ("The above assumes you have a combo box where
you select text values like "Project Team" and two text boxes where you enter
the beginning and ending dates.")

Thanks for the advice, I'm going to try that now.

Beetle said:
Use the WhereCondition argumant of the OpenReport method.
For example;

Private Sub cmdPrint_Click ()

Dim strCriteria As String

strCriteria = "[ClientGroup]=""" & Me!cboClientGroup & _
""" And [PayStart] >=#" & Me!txtPayStart & _
"# And [PayEnd] <=#" & Me!txtPayEnd & "#"

DoCmd.OpenReport "rptYourReport", acViewPreview, , strCriteria

End Sub

The above assumes you have a combo box where you select text
values like "Project Team" and two text boxes where you enter
the beginning and ending dates.

--
_________

Sean Bailey


BrookieOU said:
I have a form that allows a user to choose a Client Group and a pay period
range and it will pull the appropriate billing information for that specific
group and pay period (i.e. Project Team 2/15/09 - 3/15/09 pay period). What
it shows, in datasheet format, is the Consultant Name, Pay Period, Hours
Worked and Hours Billed. What I want to do is be able to print the
corresponding report directly from the form by adding a "print" button to the
header where the parameter choices are.

I want the report to only show the information based on the parameters a
person has entered...any suggestions?

Thanks,
Brooke
 
B

BrookieOU

Thank you soooooo much for your help! That worked like a charm!

Brooke

BrookieOU said:
That is exactly what I have ("The above assumes you have a combo box where
you select text values like "Project Team" and two text boxes where you enter
the beginning and ending dates.")

Thanks for the advice, I'm going to try that now.

Beetle said:
Use the WhereCondition argumant of the OpenReport method.
For example;

Private Sub cmdPrint_Click ()

Dim strCriteria As String

strCriteria = "[ClientGroup]=""" & Me!cboClientGroup & _
""" And [PayStart] >=#" & Me!txtPayStart & _
"# And [PayEnd] <=#" & Me!txtPayEnd & "#"

DoCmd.OpenReport "rptYourReport", acViewPreview, , strCriteria

End Sub

The above assumes you have a combo box where you select text
values like "Project Team" and two text boxes where you enter
the beginning and ending dates.

--
_________

Sean Bailey


BrookieOU said:
I have a form that allows a user to choose a Client Group and a pay period
range and it will pull the appropriate billing information for that specific
group and pay period (i.e. Project Team 2/15/09 - 3/15/09 pay period). What
it shows, in datasheet format, is the Consultant Name, Pay Period, Hours
Worked and Hours Billed. What I want to do is be able to print the
corresponding report directly from the form by adding a "print" button to the
header where the parameter choices are.

I want the report to only show the information based on the parameters a
person has entered...any suggestions?

Thanks,
Brooke
 
B

Beetle

Happy to help :)

--
_________

Sean Bailey


BrookieOU said:
Thank you soooooo much for your help! That worked like a charm!

Brooke

BrookieOU said:
That is exactly what I have ("The above assumes you have a combo box where
you select text values like "Project Team" and two text boxes where you enter
the beginning and ending dates.")

Thanks for the advice, I'm going to try that now.

Beetle said:
Use the WhereCondition argumant of the OpenReport method.
For example;

Private Sub cmdPrint_Click ()

Dim strCriteria As String

strCriteria = "[ClientGroup]=""" & Me!cboClientGroup & _
""" And [PayStart] >=#" & Me!txtPayStart & _
"# And [PayEnd] <=#" & Me!txtPayEnd & "#"

DoCmd.OpenReport "rptYourReport", acViewPreview, , strCriteria

End Sub

The above assumes you have a combo box where you select text
values like "Project Team" and two text boxes where you enter
the beginning and ending dates.

--
_________

Sean Bailey


:

I have a form that allows a user to choose a Client Group and a pay period
range and it will pull the appropriate billing information for that specific
group and pay period (i.e. Project Team 2/15/09 - 3/15/09 pay period). What
it shows, in datasheet format, is the Consultant Name, Pay Period, Hours
Worked and Hours Billed. What I want to do is be able to print the
corresponding report directly from the form by adding a "print" button to the
header where the parameter choices are.

I want the report to only show the information based on the parameters a
person has entered...any suggestions?

Thanks,
Brooke
 

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