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

Printing Current Record after selecting field from Combo Box

Status
Not open for further replies.

johnywest

MIS
Feb 19, 2003
15
US
Hello all,
Here's what I am trying to do. I have a report that I only want to print a selected record(not all of them). I invision a combo box with the field data to select report from i.e. a Date field. So when I select the combo box datefield I want it to print a report of only that record. Anyone have some suggestions. Thanks in advance.
John
 
Hi, this is pretty easy.

First, name your combo box if you have not done so, to something recognizable...CboDate

Use the expression builder in the criteria section of the date field in your reports underlying query to build something like: Forms![YourForm]![CboDate].

It's better to use something unique to the record like an ID# as a date field will give you all records with that particular date.

Back to the CboDate: Use the code builder in the combo boxes Event: After Update

and type:
DoCmd.OpenReport "YourRptName", acViewPreview ' preview first.

or:

DoCmd.OpenReport "YourRptName", acViewNormal ' Print

Save it and try it out.

Hope that helps.



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top