Hi have a massive problem i just can't solve!!!
I have a form 'orders' that has a number of reports that are generated from it. One of these reports needs a unique number assigned to it.
This report is not necessarily generatde for each record. this means that i cannot use a 'autonumber' or a PK as the number would not be sequential.
For some mad idea each time an invoice is generated a number must be generated. (for analysis reasons) and not one number can be redundant.
I intially approched this problem and realised that i would need some code in the 'on click' detail buton used to generate this report.
I have begun...but this code simply won't work
Am i even on the right track?
Private Sub PI_Click()
On Error GoTo Err_PI_Click
Dim stDocName As String
Me.InvoiceNo = Me.InvoiceNo + 1
stDocName = "Invoice"
DoCmd.OpenReport stDocName, acPreview
Exit_PI_Click:
Exit Sub
Err_PI_Click:
MsgBox Err.Description
Resume Exit_PI_Click
End Sub
I have made a field in my table called 'invoice no.' as i need a record stored of this number in relation to the record it is stored as.
Any help or suggestions would be massively appreciated. Thank you
Sarah
I have a form 'orders' that has a number of reports that are generated from it. One of these reports needs a unique number assigned to it.
This report is not necessarily generatde for each record. this means that i cannot use a 'autonumber' or a PK as the number would not be sequential.
For some mad idea each time an invoice is generated a number must be generated. (for analysis reasons) and not one number can be redundant.
I intially approched this problem and realised that i would need some code in the 'on click' detail buton used to generate this report.
I have begun...but this code simply won't work
Am i even on the right track?
Private Sub PI_Click()
On Error GoTo Err_PI_Click
Dim stDocName As String
Me.InvoiceNo = Me.InvoiceNo + 1
stDocName = "Invoice"
DoCmd.OpenReport stDocName, acPreview
Exit_PI_Click:
Exit Sub
Err_PI_Click:
MsgBox Err.Description
Resume Exit_PI_Click
End Sub
I have made a field in my table called 'invoice no.' as i need a record stored of this number in relation to the record it is stored as.
Any help or suggestions would be massively appreciated. Thank you
Sarah