After update from subform

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

Guest

Main form - MREOBRequest
Subform - MREOBCompletion
I would like the after update of "MREOBCompletion subform.CompletedBy" to
set "MREOBRequest.Complete" to true if not null and false if null.
"MREOBRequest.Complete" is a checkbox. This is what I have come up with so
far, but access is telling me a reference is missing.

Private Sub CompletedBy_AfterUpdate(Cancel As Integer)
If Me!CompletedBy Is Not Null Then
Me.MREOBCompletion!Complete = True
Else
Me.MREOBCompletion!Complete = False
End If
End Sub
 
This did not work either. I think there is something wrong with the use of .
or ! in my code.
Private Sub CompletedBy_AfterUpdate(Cancel As Integer)
If Not IsNull(Me!CompletedBy) Then
Me.MREOBCompletion!Complete = True
Else
Me.MREOBCompletion!Complete = False
End If
End Sub
 
This is the error message:
Procedure declaration does not match description of event or procedure
having the same name.
 
I wasn't paying attention. you are referencing a control on the main form
from the subform, correct?

Then use :

Private Sub CompletedBy_AfterUpdate(Cancel As Integer)
If Not IsNull(Me!CompletedBy) Then
Me.Parent!Complete = True
Else
Me.Parent!Complete = False
End If
End Sub

Damon
 
Yes, I am referencing a control on the main form from a subform. This code
matches what you have told me to enter and I still get this error message.

Procedure declaration does not match description of event or procedure
having the same name.

Private Sub CompletedBy_AfterUpdate(Cancel As Integer)
If Not IsNull(Me!CompletedBy) Then
Me.MREOBCompletion!Complete = True
Else
Me.MREOBCompletion!Complete = False
End If
End Sub
 
You used my code that uses the word "parent" - correct?

If you still have the problem, then run compile under the debug menu
selection in VB window, and that may show where the error is. If that
doesn't work, put a breakpoint on the afterupdate code and see where the
error appears. Lastly, try compacting and repairing of your db. On
restart, if msg is still there, create a new form and copy all the controls
to the new form. Make sure your control names are correct!

HTH
Damon
 
Back
Top