By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
461,938 Members | 753 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 461,938 IT Pros & Developers. It's quick & easy.

DoCmd.OpenReport "Invoice", acPreview

P: 2

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
Share this Question
Share on Google+
4 Replies

Expert 100+
P: 1,134
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

Expert 100+
P: 489
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

P: 2
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

Expert 100+
P: 489
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.