Dirty expression help

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

i'm having some problems with this code. i'm trying to see if a subform is
dirty from another subform in the same form.

here is the code

If Forms!ProctorForm!ProctorSbfrm1.Form.Dirty = True Then
msgbox"Yes"
else
msgbox"no"
End if

ProctorForm is the main form and proctorSbfrm1 is the subform I want to see
if it is dirty. Proctorsbfrm2 is the subform i'm running the code from.

I get an error saying it cant find the subform.

Any help would be great

Thank you
David
 
David said:
Hello,

i'm having some problems with this code. i'm trying to see if a
subform is dirty from another subform in the same form.

here is the code

If Forms!ProctorForm!ProctorSbfrm1.Form.Dirty = True Then
msgbox"Yes"
else
msgbox"no"
End if

ProctorForm is the main form and proctorSbfrm1 is the subform I want
to see if it is dirty. Proctorsbfrm2 is the subform i'm running the
code from.

I get an error saying it cant find the subform.

Any help would be great

Thank you
David

Your reference looks syntactically correct to me, though you could
shorten a bit to:

If Me.Parent!ProctorSbfrm1.Form.Dirty = True Then

One place errors creep in, in these references, is using the name of the
form object itself (being used as a subform) instead of the name of the
subform control displaying that form. You must use the name of the
subform control, which may or may not be the same as the name of the
form that is its Source Object.

Another place I've seen errors is when the reference is made too early
in the sequence of events of the main form. My experiments so far
suggest that the subform's form object isn't hooked up to the subform
control until the main form's Open event has finished executing.
Meanwhile, various things you can do may delay the completion of the
Open event. So where in your code are you making the reference?
 
Back
Top