-
Hi,
I am using MS Access97. I can use the printdlg api to open up the Print dialog but i am unable to retrieve what printer the user selected & then get my report to print to that printer (probably using prtDevNames & prtDevMode properties). Here is the code i have that opens the print dialog but i am kinda a lost on what to do after the dialog has been open....any suggestions would be greatly appreciated....
Also how can i set the prtdevnames & prtdevmode properties back to the original way
CODE
----
Dim lngretVal As Long
Dim udtPrDlg As PrintDlg
With udtPrDlg
.lStructSize = Len(udtPrDlg)
.hwndOwner = frm.Hwnd
'set other struct members here
End With
lngretVal = PrintDlg(udtPrDlg)
DoCmd.OpenReport "tickets", acViewNormal, "ticketqry"
' The above line sends the report to the printer, but the default printer & not the one selected by the user.
-
OK, I guess this has become too complicated....
Would anyone Instead know how to simply open the printers folder from Code...
-
I'm not sure if this is what you need, but take a look.
Update: Sorry that is for Windows CE :(
But take a look at this one.
Hope this helps.
[Edited by dsy5 on 10-06-2000 at 07:47 PM]
-
Ok, I think I've found your solution! Try this code:
Code:
Shell ("rundll32.exe shell32.dll,SHHelpShortcuts_RunDLL PrintersFolder")
-
You also may be able to use this code for ideas on how to change the default printer using the registry.
You could maybe write to the registry with API to change it.
-
http://www.vbapi.com/ref/p/printdlg.html should get you up and running with the PrintDlg API call. As I found out the hard way, the printer and print spooler API calls are nothing you want to tackle within VB on your own. Defining, receiving, unpacking, and repacking the data structures used in these calls is decidedly non-obvious and non-trivial.
John Fritch