How can I let the code pause for user input

cjamps

Registered User.
Local time
Today, 04:19
Joined
Feb 2, 2009
Messages
29
I have the following code if a command button is pushed
DoCmd.OpenReport "RCE", acViewPreview
DoCmd.OutputTo acOutputReport, RCE, "SnapshotFormat(*.snp)", "C:\MyDocuments\" & DocketNumber & "RCE.PDF".

How can I make it pause to see if the user likes the preview in order to save it as a PDF file.
 
slip the blue bits in your code

DoCmd.OpenReport "RCE", acViewPreview

while isopen("RCE",acreport)
doevents
wend

if msgbox("Send as PDF",vbyesno) = vbno then exit sub


DoCmd.OutputTo acOutputReport, RCE, "SnapshotFormat(*.snp)", "C:\MyDocuments\" & DocketNumber & "RCE.PDF".

-------
isopen function

look at syscmd function

Code:
Function IsOpen(strName As String, Optional objtype As Integer = acForm)
    IsOpen = (SysCmd(acSysCmdGetObjectState, objtype, strName) <> 0)
End Function
 

Users who are viewing this thread

Back
Top Bottom