After the default printer has been changed by code in Access 2003, the application still directs a r

I

i8mypnuts

Could someone please help? I am using the 'defaultprt.zip' tool
provided by Ken Getz to change the default printer via VBA code (code
below). My problem is that once the default printer has been changed,
Access 2003 still directs the report to the former default printer.
Access 2003 picks up the new default printer setting only after I have
reopened the application. I have checked the default printer setting in

the OS control panel and the code works well. This problem also occurs
when an Access 2003 application is open and one changes the default
printer manually in the control panel (Windows 2000).

To me it seems that Access 2003 picks up the default printer setting
once at Application Start-up only. Is there a way that I can force
Access to "refresh" the default printer after I have changed it by
code without closing/reopening the application?

THANKS

Code to SET DEFAULT PRINTER by Ken Getz:
Option Compare Database 'Use database order for string comparisons
Option Explicit

' Code from:
' Microsoft Access 95 How-To
' (c) 1998 Ken Getz and Paul Litwin
' All rights reserved.

' You may only use this code as part of an application
' that requires its use. You must including this
' notice intact. You may not distribute the code
' as your own work, nor can you distribute the
' code on its own.

Private Function BuildName(dr As aht_tagDeviceRec) As Variant

' Build up the string in the format:
' HP LaserJet 4 on LPT1:
' for display in the combo box.

BuildName = dr.drDeviceName & " on " & dr.drPort

End Function

Private Sub Button0_Click()

DoCmd.Close

End Sub
 
D

Douglas J Steele

Already answered in another newsgroup to which you posted the same question.

If you feel you need to post to more than one group (HINT: it's seldom
necessary), please have the courtesy to cross-post (send the one message to
all groups at once), rather than multi-post (send individual messages to
each group). In this way, all responses to your post will be available
together, regardless of what group the responder was in, and the rest of us
won't have to read your post multiple times. (It also uses fewer server
resources)
 

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

Top