Hi
i hope you can help my company uses access and has modified for its needs usually what happens is you serach for the invoice by its number and then it brings all the information up such as entry fields and so there is a button you press which then takes to through to a print preview of the invoice and you print out the invoice but recent ly this message ahs started appearing and does not allow you to view the print preview of the invoice and crashes.
Run Time error 2501
The OpenReport action was cancelled , and when i debug it it Higghlights this line of the code as the problem
Private Sub Command183_Click()
'Me.invoicedate.Locked = False
'Me.invoicedate = Date
'DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
'Me.invoicedate.Locked = True
If Nz(Me.FeeRequired, 0) = 0 Then
MsgBox "No value to invoice (Fee Due)"
Else
'''
DoCmd.SetWarnings False
DoCmd.OpenQuery "AltAddress0"
DoCmd.OpenQuery "AltAddress1"
DoCmd.SetWarnings True
If Forms![mainMENU]![teamleader] = -1 Then
If Forms![TBSV]![Terms] <> 417 Then
If Me.InvoiceDate & "x" = "x" Then
Me.InvoiceDate = Me.PaymentDate
End If
Else
If Me.InvoiceDate & "x" = "x" Then Me.InvoiceDate = Date
End If
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
End If
DoEvents
'''
'If Me.invoicedate & "x" = "x" Then
' MsgBox "No Invoice Date"
'Else
If Nz(Me.Multiple, 0) = 0 Then
DoCmd.OpenReport "Invoice", acPreview
Else
Dim ANS As Integer
ANS = MsgBox("Multiple Instruction Invoice?", vbYesNoCancel, "TBSV")
If ANS = 6 Then DoCmd.OpenReport "Invoice", acPreview
If ANS = 7 Then DoCmd.OpenReport "Invoice", acPreview
'vbOK 1 OK
'vbCancel 2 Cancel
'vbAbort 3 Abort
'vbRetry 4 Retry
'vbIgnore 5 Ignore
'vbYes 6 Yes
'vbNo 7 No
End If
'End If
End If
End Sub
Can anyone help regarding this please as it is driving me up the wall i have posted the entire code to see if there is a problem in there.
Thanks