471,117 Members | 1,230 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,117 software developers and data experts.

DoCmd.OpenReport "Invoice", acPreview


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)"

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
If Me.InvoiceDate & "x" = "x" Then Me.InvoiceDate = Date
End If
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
End If
'If Me.invoicedate & "x" = "x" Then
' MsgBox "No Invoice Date"
If Nz(Me.Multiple, 0) = 0 Then
DoCmd.OpenReport "Invoice", acPreview
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.

Jan 16 '09 #1
4 6386
1,134 Expert 1GB
The opening of the report was cancelled for some reason.
Not sure if this would apply because it is being opened as a preview but try checking out the printer.
Is it connected and on?
Can the computer running the db print a test page to it?

Just a stab in the dark.
I wouldn't suspect the code unless you have reason to believe it might have been changed recently!
Jan 16 '09 #2
489 Expert 256MB
Access requires the print spooler service to be running to even preview a report. I've had this problem before and all I've done is restart the service to fix it.
Jan 16 '09 #3
how would i go about resetting the print spooler service in access or on my computer im afraid i am not that technically gifted.
Jan 16 '09 #4
489 Expert 256MB
If you are using XP, click the start button then select Run. In the run window type services.msc and click OK.

If it's Vista, click the start button and type services.msc into the search box at the bottom and press return

In the Services window scroll down until you find the Print Services service, right click on it and select restart from the menu.
Jan 16 '09 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

10 posts views Thread by Average_Joe | last post: by
2 posts views Thread by Mark Bordner | last post: by
1 post views Thread by DD | last post: by
1 post views Thread by shumaker | last post: by
1 post views Thread by John | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.