After update from subform

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
 
G

Guest

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
 
G

Guest

This is the error message:
Procedure declaration does not match description of event or procedure
having the same name.
 
D

Damon Heron

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
 
G

Guest

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
 
D

Damon Heron

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top