Click to See Complete Forum and Search --> : VBA Printer change


MikeHaines
January 2nd, 2000, 11:02 PM
I have seen some techniques for changing the default printer in visual basic. But how do you do this in Access Basic, where there is no printer object?

mindless in middletown

Nath
January 4th, 2000, 02:40 PM
I don't know if it's what you're looking for but that code makes you open the file menu in the menu bar and opens the printer box and after that well it's as usual.


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

'the next line is the one that opens the
'file menu to open the printer box the number 6
'is the row order for the printer in the file menu
DoCmd.DoMenuItem acFormBar, acFile, 6

Exit_ImageImprimante_Click:
Exit Sub

Err_ImageImprimante_Click:
MsgBox Err.Description
Resume Exit_ImageImprimante_Click

End Sub

hope this works and that's what you were looking for


nath :)

MikeHaines
January 4th, 2000, 11:11 PM
merci pour la reponse!

I ended up solving the problem using a WriteProfileString to change the default printer in the Win.ini

Thanks again!