Hey Jim! Now Access (in its infinite wisdom) totally disregards the
frmParamUnit and displays once again it's default parameter dialog box.
Here's my code for rptMenuForm:
Private Sub cmdActiveByUnit_Click()
On Error GoTo Err_cmdActiveByUnit_Click
Dim stDocName As String
stDocName = "rptMonthlyUnitReport"
DoCmd.OpenForm "frmParamUnit", acNormal, , , acFormEdit, acDialog
If txtFieldStatus = 0 Then
DoCmd.OpenReport stDocName, acPreview
DoCmd.Maximize
End If
Exit_cmdActiveByUnit_Click:
Exit Sub
Err_cmdActiveByUnit_Click:
MsgBox Err.Description
Resume Exit_cmdActiveByUnit_Click:
End Sub
And here's my code for frmParamUnit:
Private Sub cmdOk_Click()
On Error GoTo Err_cmdOk_Click
Forms!frmReportMenu!txtFieldStatus = 0
DoCmd.Close acForm, "frmParamUnit"
Exit_cmdOk_Click:
Exit Sub
Err_cmdOk_Click:
MsgBox Err.Description
Resume Exit_cmdOk_Click
End Sub
Private Sub cmdCancel_Click()
On Error GoTo Err_cmdCancel_Click
Forms!frmReportMenu!txtFieldStatus = -1
DoCmd.Close acForm, "frmParamUnit"
Exit_cmdCancel_Click:
Exit Sub
Err_cmdCancel_Click:
MsgBox Err.Description
Resume Exit_cmdCancel_Click
End Sub
Have a great weekend.
--
Thanks,
Tina Hudson
"JimBurke via AccessMonster.com" wrote:
> It looks like you'e not opening the form as a pop-up. Even if you set the
> form's popup property to Yes, you still have to open the form using the
> acDialog parameter...
>
> DoCmd.OpenForm "frmWhatever", acNormal, , , acFormEdit, acDialog
>
> If you don't use the acDialog parm then as soon as you open the form the next
> statement executes. In your case, it's checking the value of txtStatusField
> as soon as the form is opened, before you've had a chance to do anything on
> the popup form. By opening it with acDialog, the next statement doesn't run
> until the popup form is closed. Pretty sure that's what's going on.
> Everything else looks OK from what I can see.
>
> Tina Hudson wrote:
> >Ok. Still not working. : (
> >
> >I know the code below doesn't work, but I was hoping you could point out the
> >errors of my ways!
> >
> >Thanks for your patience, by the way.
> >
> >Here's my code for one of the command buttons in the frmReport Menu:
> >
> >Private Sub cmdActiveByUnit_Click()
> >On Error GoTo Err_cmdActiveByUnit_Click
> >
> > Dim stDocName As String
> > stDocName = "rptMonthlyUnitReport"
> >
> > DoCmd.OpenForm "frmParamUnit" 'this parameter form is set as popup
> >
> > If txtStatusField = 0 Then
> >
> > DoCmd.OpenReport stDocName, acPreview
> > DoCmd.Maximize
> >
> > End If
> >
> >Exit_cmdActiveByUnit_Click:
> > Exit Sub
> >
> >Err_cmdActiveByUnit_Click:
> > MsgBox Err.Description
> > Resume Exit_cmdActiveByUnit_Click
> >
> >End Sub
> >
> >
> >Here's the code for the parameter form for the above button:
> >
> >Option Compare Database
> >Option Explicit
> >
> >Private Sub cmdOk_Click()
> >'This is used when user enters 1 parameter and wants to open report
> > Forms!frmReportMenu!txtStatusField = 0
> > DoCmd.Close acForm, "frmParamUnit"
> >
> >End Sub
> >
> >Private Sub cmdCancel_Click()
> >'This is if user changes mind and doesn't want to open report
> > Forms!frmReportMenu!txtStatusField = -1
> >
> > DoCmd.Close acForm, "frmParamUnit", acSaveNo
> >
> >End Sub
> >
> >> Sorry about that, I only noticed the part of the earlier note that said 'So,
> >> depending upon which report a user wants, the same parameter form opens.' So
> >[quoted text clipped - 49 lines]
> >> >> >> >
> >> >> >> >End Sub
>
> --
> Jim Burke
>
> Message posted via http://www.accessmonster.com
>
>