Run-time error 3021 when attempting to Print (1 Viewer)

dzirkelb

Registered User.
Local time
Today, 14:15
Joined
Jan 14, 2005
Messages
180
We are upgrading one of our servers, and when i simply copied the entire Access database (that has worked for years with no issues) to the new server, i get an erorr when trying to print:

Run-time error '3021': No Current Record

I have some code in place that runs a query to get the variable intCountOfPackSlips. Then, if that count is > 0, I print a pack slip.

In the example i'm testing with (again, works perfectly fine on other server), the Coun to Pack slips is 1. Here is the relevenat code that is erroring out:

Code:
        If intCountOfPackSlips > 0 Then
            DoCmd.SelectObject acReport, "PACKING SLIP-A", True
            DoCmd.PrintOut acPrintAll, , , , intCountOfPackSlips
        End If

The actual error code is DoCmd.PrintOut acPrintAll, , , , intCountOfPackSlips.

When i review the report itself, it has data and i can print manually.

What could cause this issue / what other information is needed?
 

moke123

AWF VIP
Local time
Today, 15:15
Joined
Jan 11, 2013
Messages
3,920
Why not open the report with acViewNormal which sends it to the printer?
 

dzirkelb

Registered User.
Local time
Today, 14:15
Joined
Jan 14, 2005
Messages
180
I don't have any specific reason besides it works on the old server, so I left as is. Is this what you are suggesting i should change below? I'm not good with Access VBA (or VBA in general) outside of datra manipulation (calling data, updating, querying, etc).

Code:
       If intCountOfPackSlips > 0 Then
            DoCmd.SelectObject acViewNormal, "PACKING SLIP-A", True
            DoCmd.PrintOut acPrintAll, , , , intCountOfPackSlips
        End If
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 14:15
Joined
Feb 28, 2001
Messages
27,188
When you upgraded the server, did you upgrade its drivers for each remove printer you have? There is a "generic" Windows printer driver that will work for networked printers, but if you have the vendor's preferred driver it will work better. This is to be taken as a "stab in the dark" suggestion.
 

dzirkelb

Registered User.
Local time
Today, 14:15
Joined
Jan 14, 2005
Messages
180
When you upgraded the server, did you upgrade its drivers for each remove printer you have? There is a "generic" Windows printer driver that will work for networked printers, but if you have the vendor's preferred driver it will work better. This is to be taken as a "stab in the dark" suggestion.
I used the same drivers as installed on server 2012 to server 2022. The printers appear to be working fine when print jobs are sent to them manually.
 

dzirkelb

Registered User.
Local time
Today, 14:15
Joined
Jan 14, 2005
Messages
180


Thank you - reviewing now and hope to do something today. Had a guy quit on me last week so having to pick up his workload, sorry for lack of reponses.
 

dzirkelb

Registered User.
Local time
Today, 14:15
Joined
Jan 14, 2005
Messages
180


I can see the job spooling in the printer queue, it appears to print, but i then get an error on access stating "Run-time error '2212': Microsoft Access couldn't print your object". The application then is stuck and can not move forward without intervention, and the rest of the code stops. Below is what i have coded, what should I try next?

Code:
        If intCountOfPackSlips > 0 Then
            DoCmd.OpenReport "PACKING SLIP-A", acViewPreview
            DoCmd.PrintOut acPrintAll, , , , intCountOfPackSlips
        End If
 

moke123

AWF VIP
Local time
Today, 15:15
Joined
Jan 11, 2013
Messages
3,920
Have you tried

Code:
DoCmd.OpenReport "PACKING SLIP-A", acViewNormal

which will send the report straight to the default printer?
 

dzirkelb

Registered User.
Local time
Today, 14:15
Joined
Jan 14, 2005
Messages
180
Have you tried

Code:
DoCmd.OpenReport "PACKING SLIP-A", acViewNormal

which will send the report straight to the default printer?
I get the same issue - sends the print job but gives same error.
 

moke123

AWF VIP
Local time
Today, 15:15
Joined
Jan 11, 2013
Messages
3,920
Check your printer settings in print preview?
 

dzirkelb

Registered User.
Local time
Today, 14:15
Joined
Jan 14, 2005
Messages
180
it prints fine, just throws the error, causing the rest of the automation to fail.
 

dzirkelb

Registered User.
Local time
Today, 14:15
Joined
Jan 14, 2005
Messages
180
I have narrowed the issue to be specific to this report, and a plugin we use to generate bar codes. Thank you for all the help, but this is now a development issue that I need to figure out with the bar code company.
 

Users who are viewing this thread

Top Bottom