runtime error 2212

G

Guest

This code works on my local network but when I take it to another company, it
worked once. Now it give the runtime error 2212. If I take it to a third
network, I still get the error. Here is the code:

Dim strDetailCriteria As String
Dim strDefaultPrinter As String

strDefaultPrinter = Application.Printer.DeviceName
Set Application.Printer = Application.Printers(strDefaultPrinter)

strDetailCriteria = "[MaID]=" & Chr(34) & Me.txtMaID & Chr(34) & " AND
[ORN]=" & Chr(34) & Me.txtORN & Chr(34)

DoCmd.OpenReport "rptMA_ContractMaster", acViewNormal, ,
strDetailCriteria


Does anyone know what a 2212 error is or what might be the cause?

Thanks for any help!
 
A

Allen Browne

The Printer object was first introduced in Access 2002.

Any chance that the machine that does not like the code is Access 2000?

Alternatively, is it possible that the machine does not have a printer
installed?
 
G

Guest

I added the code to set the printer object because I thought that might me
the issue. In all situations we are using Access 2003. The same error
occurs even if I remove the printer object code.

Any ideas?

Thanks for the help.

Bob

Allen Browne said:
The Printer object was first introduced in Access 2002.

Any chance that the machine that does not like the code is Access 2000?

Alternatively, is it possible that the machine does not have a printer
installed?

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Bob said:
This code works on my local network but when I take it to another company,
it
worked once. Now it give the runtime error 2212. If I take it to a third
network, I still get the error. Here is the code:

Dim strDetailCriteria As String
Dim strDefaultPrinter As String

strDefaultPrinter = Application.Printer.DeviceName
Set Application.Printer = Application.Printers(strDefaultPrinter)

strDetailCriteria = "[MaID]=" & Chr(34) & Me.txtMaID & Chr(34) & " AND
[ORN]=" & Chr(34) & Me.txtORN & Chr(34)

DoCmd.OpenReport "rptMA_ContractMaster", acViewNormal, ,
strDetailCriteria


Does anyone know what a 2212 error is or what might be the cause?

Thanks for any help!
 
A

Allen Browne

Which line causes the error?

If it is the OpenReport line, try it without the criteria.
If that works, the problem is with your criteria.
If it still fails, the problem is with the report name or references.

Uncheck the boxes under:
Tools | Options | General | Name AutoCorrect
Then compact:
Tools | Database Utilities | Compact
Explanation:
http://members.iinet.net.au/~allenbrowne/bug-03.html

Regarding references, see:
http://members.iinet.net.au/~allenbrowne/ser-38.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Bob said:
I added the code to set the printer object because I thought that might me
the issue. In all situations we are using Access 2003. The same error
occurs even if I remove the printer object code.

Any ideas?

Thanks for the help.

Bob

Allen Browne said:
The Printer object was first introduced in Access 2002.

Any chance that the machine that does not like the code is Access 2000?

Alternatively, is it possible that the machine does not have a printer
installed?


Bob said:
This code works on my local network but when I take it to another
company,
it
worked once. Now it give the runtime error 2212. If I take it to a
third
network, I still get the error. Here is the code:

Dim strDetailCriteria As String
Dim strDefaultPrinter As String

strDefaultPrinter = Application.Printer.DeviceName
Set Application.Printer = Application.Printers(strDefaultPrinter)

strDetailCriteria = "[MaID]=" & Chr(34) & Me.txtMaID & Chr(34) & "
AND
[ORN]=" & Chr(34) & Me.txtORN & Chr(34)

DoCmd.OpenReport "rptMA_ContractMaster", acViewNormal, ,
strDetailCriteria


Does anyone know what a 2212 error is or what might be the cause?

Thanks for any help!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top