on a button i need to be able to choose witch printer i need to print on. i have no idea the way to do it.
thank you in advanced
Printable View
on a button i need to be able to choose witch printer i need to print on. i have no idea the way to do it.
thank you in advanced
First, include the visual basic common dialog controls in your application (by pressing Ctrl-T). Place the common dialog control in your form. Now, include this code in your button's Command1_click() command.
Sub Command1_Click()
Commondialog1.ShowPrinter 'This brings up the print dialog box
'which will give you a selection of printers
'in your system.
End Sub
Hope that this helps...
Cheers...
thanks a lot
nath
Also you can select a printer programatically from your VB application. Check follow sample:
http://vbcode.webhostme.com/en/click.asp?id=80
[email protected]
http://vbcode.webhostme.com/
thank you for you're help
but it doesn't work on a click button but i'm keeping the code for futur use and the adress
nath
I wanted to thank you for the help andi found the code that worked for me so here it is if you ever need it
Private Sub ImageImprimante_Click()
On Error GoTo Err_ImageImprimante_Click
DoCmd.DoMenuItem acFormBar, acrecordmenu, acSaveRecord, , acMenuVer70
Dim stDocName As String, Critere As Variant
Critere = Me![No_Appel]
stDocName = "E_NoAppel"
DoCmd.OpenReport stDocName, acViewPreview, [No_Appel], "[No_Appel] = " & Critere
'This is the line that opens the file menu printer
' to be able to choose the printer
DoCmd.DoMenuItem acFormBar, acFile, 6
Exit_ImageImprimante_Click:
Exit Sub
Err_ImageImprimante_Click:
MsgBox Err.Description
Resume Exit_ImageImprimante_Click
End Sub
And Happy holydays
nath :)