Part of my access application does invoicing. I have an invoice number table that wholes one field "InvoiceNum". On my invoice report I have the following code:
Private Sub Report_Open(Cancel As Integer)
'lookup invoice number when invoice opens
intInvoiceNum = Nz(DLookup("InvoiceNum", "tblInvoiceNum"), 0)
End Sub`
Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As Integer)
'Incrementally add one (1) to the invoice number for every page of in the report
Me.txtInvoiceNum = intInvoiceNum
intInvoiceNum = intInvoiceNum + 1
End Sub`
Private Sub Report_Close()
'Update tblInvoiceNum with the last invoice number in the report
db.Execute ("UPDATE InvoiceNum SET InvoiceNum = " & intInvoiceNum)
End_Sub`
Problem: My report open with groupby ClientID and ProjectNum. Multiple invoices print on the same report. If any invoice spills over to second page the Format Code runs again inserting an incremental invoice number to the second page. How can I prevent this from happening?
1
appended to the Invoice Number? Maybe in the query add a field that does something like what you would need (I'm not sure how to group them).. There are also properties where you can select "Keep on one page", but I'm not sure if that would work. – Mark C.