H
HeislerKurt
I'm trying to hide/show two labels on a popup form (frmPopup) based on
how the form was called from a subform.
The subform (fsubPeople) is in continuous view. It's a sub sub form
(i.e., MainForm > SubForm1 > fsubPeople). There's a command button in
the Detail section, and a command button in the Form Header.
If the user clicks on the command button in the Detail section (which
opens frmPopup filtered to a matching record), things work: I can set
and hide the labels correctly. But if the user clicks on the command
button in the Form Header (which opens frmPopup in acFormAdd, acDialog
mode), I get the error:
"... can't find the form 'frmPopup' referred to a macro or visual
basic expression."
Any idea how I can correctly refer to the label controls when the form
is opened in acFormAdd mode?
Thank you!
----
Code from button in Detail Section (hiding/showing the labels works!)
###
Private Sub cmdEditPersonInfo_Click()
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, ,
acMenuVer70
DoCmd.openForm "frmPopup"
Forms!frmPopup.RecordSource = "SELECT DISTINCTROW tblPeople.* " & _
"FROM tblPeople " & _
"WHERE ((tblPeople.PersonID=Forms!frmPatients!
frmReferrals.Form!fsubPeople.Form!PersonID));"
Forms!frmPopup.cmdAssignToPatient.Visible = False
Forms!frmPopup.cmdSave.Visible = True
End Sub
###
Code from button in Form Header Section (this causes the error)
###
Private Sub cmdAssignNewPerson_Click()
DoCmd.openForm "frmPopup", , , , acFormAdd, acDialog
Forms!frmPopup.cmdAssignNewPerson.Visible = True
Forms!frmPopup.cmdSave.Visible = False
End Sub
###
how the form was called from a subform.
The subform (fsubPeople) is in continuous view. It's a sub sub form
(i.e., MainForm > SubForm1 > fsubPeople). There's a command button in
the Detail section, and a command button in the Form Header.
If the user clicks on the command button in the Detail section (which
opens frmPopup filtered to a matching record), things work: I can set
and hide the labels correctly. But if the user clicks on the command
button in the Form Header (which opens frmPopup in acFormAdd, acDialog
mode), I get the error:
"... can't find the form 'frmPopup' referred to a macro or visual
basic expression."
Any idea how I can correctly refer to the label controls when the form
is opened in acFormAdd mode?
Thank you!
----
Code from button in Detail Section (hiding/showing the labels works!)
###
Private Sub cmdEditPersonInfo_Click()
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, ,
acMenuVer70
DoCmd.openForm "frmPopup"
Forms!frmPopup.RecordSource = "SELECT DISTINCTROW tblPeople.* " & _
"FROM tblPeople " & _
"WHERE ((tblPeople.PersonID=Forms!frmPatients!
frmReferrals.Form!fsubPeople.Form!PersonID));"
Forms!frmPopup.cmdAssignToPatient.Visible = False
Forms!frmPopup.cmdSave.Visible = True
End Sub
###
Code from button in Form Header Section (this causes the error)
###
Private Sub cmdAssignNewPerson_Click()
DoCmd.openForm "frmPopup", , , , acFormAdd, acDialog
Forms!frmPopup.cmdAssignNewPerson.Visible = True
Forms!frmPopup.cmdSave.Visible = False
End Sub
###