Calling a procedure in a parent form from a subform

R

rls0905

I am trying to trigger a procedure in a parent form from a procedure in a
subform. I tried to link it to an afterupdate event for an updated textbox
in the parent form, but this didn't work.
 
S

Stefan Hoffmann

hi,
I am trying to trigger a procedure in a parent form from a procedure in a
subform. I tried to link it to an afterupdate event for an updated textbox
in the parent form, but this didn't work.
The procedure itself must be declared as public. Use

Parent.ProcedureName Parameters

to call it.


mfG
--> stefan <--
 
S

Stefan Hoffmann

hi,

Stefan said:
The procedure itself must be declared as public. Use

Parent.ProcedureName Parameters

to call it.
Must be

Parent.Form.ProcedureName Parameters


mfG
--> stefan <--
 
S

Stefan Hoffmann

hi Dirk,

Dirk said:
I think your first version was okay. Have you tested and found
otherwise?
So both are working.

I find it easier to read code using a continuous scheme.

I'm often using methods with the subform control where i have to specify
the .Form e.g.:

FormRequery SubformCtl.Form

with

Public Function FormRequery(AForm As Access.Form, _
Optional AID As Long = 0 _
) As Boolean

On Local Error Resume Next

Dim ID As Long

If AID = 0 Then
ID = AForm![ID]
Else
ID = AID
End If

AForm.Painting = False
AForm.Requery
With AForm.RecordsetClone
.FindFirst "ID = " & ID
If Not .NoMatch Then
AForm.Bookmark = .Bookmark
End If
End With
AForm.Painting = True

FormRequery = True

End Function


mfG
--> stefan <--
 

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