Bypass Enter Parameter Value

N

NFL

I hope I don't frustrate you with another question.. Thank you for your input!

Here are the codes for the report file....

Option Compare Database

Private Sub Report_Close()

DoCmd.Close acForm, "ParaForm"
End Sub

Private Sub Report_Open(Cancel As Integer)
DoCmd.OpenForm "ParaForm", , , , , acDialog
End Sub
---------------------------------
Here are the codes for the ParaForm ....

Private Sub Command5_Click()
On Error GoTo Err_Command5_Click ' Cancel Button t

DoCmd.Close

Exit_Command5_Click:
Exit Sub

Err_Command5_Click:
MsgBox Err.Description
Resume Exit_Command5_Click

End Sub

Private Sub Command2_Click() 'OK Button to Continue
Me.Visible = False
End Sub

This is where the code begins on a separate form......

Private Sub Command119_Click() ' Main Form
On Error GoTo Err_Command119_Click

Dim stDocName As String

stDocName = "HistoryOutcomeRpt"
DoCmd.OpenReport stDocName, acPreview

Exit_Command119_Click:
Exit Sub

Err_Command119_Click:
MsgBox Err.Description
Resume Exit_Command119_Click

End Sub

The report picks a criteria by opening a form_paraform and and looks at the
combobox. The user will select the criteria and press the OK button which
works fine. What I like to do is to modify the cancel button canel the
entire process without looking at the "Enter parameter Value" box . How can
I get rid of that if a user decides he/she does not want to look at the
report?
 
M

Marshall Barton

NFL said:
I hope I don't frustrate you with another question.. Thank you for your input!

Here are the codes for the report file....

Option Compare Database

Private Sub Report_Close()

DoCmd.Close acForm, "ParaForm"
End Sub

Private Sub Report_Open(Cancel As Integer)
DoCmd.OpenForm "ParaForm", , , , , acDialog
End Sub
---------------------------------
Here are the codes for the ParaForm ....

Private Sub Command5_Click()
On Error GoTo Err_Command5_Click ' Cancel Button t

DoCmd.Close

Exit_Command5_Click:
Exit Sub

Err_Command5_Click:
MsgBox Err.Description
Resume Exit_Command5_Click

End Sub

Private Sub Command2_Click() 'OK Button to Continue
Me.Visible = False
End Sub

This is where the code begins on a separate form......

Private Sub Command119_Click() ' Main Form
On Error GoTo Err_Command119_Click

Dim stDocName As String

stDocName = "HistoryOutcomeRpt"
DoCmd.OpenReport stDocName, acPreview

Exit_Command119_Click:
Exit Sub

Err_Command119_Click:
MsgBox Err.Description
Resume Exit_Command119_Click

End Sub

The report picks a criteria by opening a form_paraform and and looks at the
combobox. The user will select the criteria and press the OK button which
works fine. What I like to do is to modify the cancel button canel the
entire process without looking at the "Enter parameter Value" box . How can
I get rid of that if a user decides he/she does not want to look at the
report?


Try something like:

Private Sub Report_Open(Cancel As Integer)
DoCmd.OpenForm "ParaForm", , , , , acDialog
If Not CurrentProject.AllForms!ParaForm.IsLoaded Then
Cancel = True
End If
End Sub

Private Sub Report_Close()
If CurrentProject.AllForms!ParaForm.IsLoaded Then
DoCmd.Close acForm, "ParaForm"
End If
End Sub
 
N

NFL

That worked! Thank you !!!

Marshall Barton said:
Try something like:

Private Sub Report_Open(Cancel As Integer)
DoCmd.OpenForm "ParaForm", , , , , acDialog
If Not CurrentProject.AllForms!ParaForm.IsLoaded Then
Cancel = True
End If
End Sub

Private Sub Report_Close()
If CurrentProject.AllForms!ParaForm.IsLoaded Then
DoCmd.Close acForm, "ParaForm"
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top