Referencing a form within another form

  • Thread starter Thread starter Shondra
  • Start date Start date
S

Shondra

The syntax below is in the closeform event of a different form,
frm_draw_reports. We are receiving an error message when the close
button is clicked that states "Microsoft Access can't find the form
'frm_draw_w_exceptions' referred to in a macro expression or Visual
Basic code."


If Forms!frm_draw_w_exceptions.Check7.Enabled = False Then
stDocName = "qry_not_drawn_PMS"
DoCmd.OpenQuery stDocName, acNormal, acEdit
DoCmd.Close acQuery, stDocName

End If

Thanks!
 
The syntax below is in the closeform event of a different form,
frm_draw_reports. We are receiving an error message when the close
button is clicked that states "Microsoft Access can't find the form
'frm_draw_w_exceptions' referred to in a macro expression or Visual
Basic code."

If Forms!frm_draw_w_exceptions.Check7.Enabled = False Then
stDocName = "qry_not_drawn_PMS"
DoCmd.OpenQuery stDocName, acNormal, acEdit
DoCmd.Close acQuery, stDocName

End If

Thanks!

Are you wanting to see if Check7 is enabled?

1) Use the bang as the formname!ControlName separator not the dot.

If forms!frm_draw_w_exceptions!Check7.Enabled = False Then

2) The form "frm_draw_w_exceptions" must be open when this code is
run.
I suspect it is not.

3) Even if the code worked, the query would open and close
immediately so you would not see it. Is that what you want?
 
Thank you Darren and Fred. We finally have the form and checkboxes
working!! I appreciate your help.
 
Back
Top