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

Passing a variable from a form to a report 1

Status
Not open for further replies.

autosol

Programmer
May 1, 2003
21
US
I am a novice Access programmer so this may seem dumb but ...

I have a form which builds a bill of lading. From a cmd button on form I print a BOL. Am trying to print multiple copies where the only thing different from one copy to the next is copy number, ie, 1 for 1st, 2 for 2nd. The following doesn't work:

Public PrintCopyCtr as Integer

cmdPrintBOL__Click '(in form)

Let PrintCopyCtr = 1
DoCmd.OPenReport.....

Let PrintCopyCtr = 2
DoCmd.OPenReport.....

End Sub

I can't find a way to get PrintCopyCtr to print on report.


Thanks

 
Do you enter the print counter number in a text box on the form???

If so, on your report, add an unbound text field and set the control source to

=Forms![formname]![controlname]

****************************
Only two things are infinite, the universe and human stupidity, and I'm not sure about the former. (Albert Einstein)

Robert L. Johnson III
MCSA, CNA, MCP, Network+, A+
w: robert.l.johnson.iii@citigroup.com
h: wildmage@tampabay.rr.com
 
Change your variable to a global variable in a database module and create this function:
Global PrintCopyCtr as Integer
Function PCC()
PCC = PrintCopyCtr
End Function

Now use PCC() in your report to call up the value of your global variable.

Let me know if you need more assistance.


Bob Scriver
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top