printing a report based on information in a form that is on screen
Posted on 2012-04-03
I have a form that i have created and at the top of the form i created a command button the user can press to print a report based on the information they have put in the form. The field that I use as the control field is called Bill. Once the form is filled out they press a button at the top labeled Print and they are supposed to see a print preview of a report that has the information they just typed into the form. The form accepts all the information and the table retains all of the data but the report is blank. Below is the code i am using for on click of the command button i created.
Private Sub Command156_Click()
On Error GoTo Err_Command156_Click
DoCmd.OpenReport "P1BOL", acViewPreview, , "[Bill]=" & Me.Bill
Dim stDocName As String
stDocName = "P1BOL"
DoCmd.OpenReport stDocName, acPreview