Eljefegeneo
Still trying to learn
- Local time
- Yesterday, 21:00
- Joined
- Jan 10, 2011
- Messages
- 902
I have a report that prints my monthly invoices with the following code:
This works fine, of course. However, there are certain invoices that inform the client that the amount due will be debited from their bank on a certain date, known as an ACH transfer. Thus the bottom half of the invoice is not necessary, where a regular invoice says: "Please cut and return this portion with your payment", etc., the lower third of the invoice.
So I made a sub called VisibilityText were if the ACH check box was true certain text would be false. Otherwise, if the payment is to be mailed, the bottom third of the report is to be visible.
That being said, I put the VisibilityText in the OnLoad Event. Is this the correct place or should it be in the OnCurrent event or another event? I have tested it on individual reports and a sample of two or three reports, but not wanting to print out the hundreds of invoices to test it, I just want to be sure I have put it in the correct event.
Thanks. And Happy Turkey Day!
Code:
Dim iCount As Integer
Dim rpt As String
Dim cond As String
Dim db As DAO.Database
Dim rs As DAO.Recordset
rpt = "rptInvoiceToBeMailed"
Set db = CurrentDb()
Set rs = db.OpenRecordset("qryInvoicePrintClientCopy")
With rs
rs.MoveFirst
Do While Not .EOF
cond = "[RecordID] = " & rs!RecordID
'Cannot open in acViewNormal as page length is too long.
DoCmd.OpenReport rpt, acViewPreview, , cond
PrintNew 'my special module to print
DoCmd.Close acReport, rpt
.MoveNext
Loop
End With
rs.Close
So I made a sub called VisibilityText were if the ACH check box was true certain text would be false. Otherwise, if the payment is to be mailed, the bottom third of the report is to be visible.
That being said, I put the VisibilityText in the OnLoad Event. Is this the correct place or should it be in the OnCurrent event or another event? I have tested it on individual reports and a sample of two or three reports, but not wanting to print out the hundreds of invoices to test it, I just want to be sure I have put it in the correct event.
Thanks. And Happy Turkey Day!