I have a button for the user to print a few different forms filtered different ways. I use the following code to change the filtering and print the different pages then close them.
Application.Echo False
DoCmd.SetWarnings False
cDept = Null
cDept = "OPS"
SFMgmtMyDept.Requery
DoCmd.OpenForm "MyDeptRosterMgmtAM", , , , , acHidden
DoCmd.RunCommand acCmdPrint
DoCmd.OpenForm "MyDeptRosterMgmtPM", , , , , acHidden
DoCmd.RunCommand acCmdPrint
DoCmd.Close acForm, "MyDeptRosterMgmtAM", acSaveYes
DoCmd.Close acForm, "MyDeptRosterMgmtPM", acSaveYes
cDept = Null
cDept = "PCC"
SFMgmtMyDept.Requery
DoCmd.OpenForm "MyDeptRosterMgmtAM", , , , , acHidden
DoCmd.RunCommand acCmdPrint
DoCmd.OpenForm "MyDeptRosterMgmtPM", , , , , acHidden
DoCmd.RunCommand acCmdPrint
DoCmd.Close acForm, "MyDeptRosterMgmtAM", acSaveYes
DoCmd.Close acForm, "MyDeptRosterMgmtPM", acSaveYes
cDept = Null
DoCmd.SetWarnings True
Application.Echo True
The problem is that the program asks if the user wants to print over and over. I thought maybe the setwarnings would hide this, but that didn't work. Is there some other code that I can use that would choose "Yes" on the users' behalf? The image shows the prompt I'm trying to bypass.
Not sure if you'll be able to see it, it's the typical Windows Print box with the name of the printer, asking if you want to print all the pages, number of copies, then Ok or Cancel. I want to hit ok here on the users' behalf.
Application.Echo False
DoCmd.SetWarnings False
cDept = Null
cDept = "OPS"
SFMgmtMyDept.Requery
DoCmd.OpenForm "MyDeptRosterMgmtAM", , , , , acHidden
DoCmd.RunCommand acCmdPrint
DoCmd.OpenForm "MyDeptRosterMgmtPM", , , , , acHidden
DoCmd.RunCommand acCmdPrint
DoCmd.Close acForm, "MyDeptRosterMgmtAM", acSaveYes
DoCmd.Close acForm, "MyDeptRosterMgmtPM", acSaveYes
cDept = Null
cDept = "PCC"
SFMgmtMyDept.Requery
DoCmd.OpenForm "MyDeptRosterMgmtAM", , , , , acHidden
DoCmd.RunCommand acCmdPrint
DoCmd.OpenForm "MyDeptRosterMgmtPM", , , , , acHidden
DoCmd.RunCommand acCmdPrint
DoCmd.Close acForm, "MyDeptRosterMgmtAM", acSaveYes
DoCmd.Close acForm, "MyDeptRosterMgmtPM", acSaveYes
cDept = Null
DoCmd.SetWarnings True
Application.Echo True
The problem is that the program asks if the user wants to print over and over. I thought maybe the setwarnings would hide this, but that didn't work. Is there some other code that I can use that would choose "Yes" on the users' behalf? The image shows the prompt I'm trying to bypass.
Not sure if you'll be able to see it, it's the typical Windows Print box with the name of the printer, asking if you want to print all the pages, number of copies, then Ok or Cancel. I want to hit ok here on the users' behalf.