Declaring Subform Name

D

Dickie

This one should be easy (but not for me)

I need to pass a Subforms name from a event on the form to a module which
will then fully qualify the subform name.

On event (lost focus Or wotever)
=Subform_Name("frmame")

The module will then add active form and subform to give me FQ name
Currform = Screen.Activeform
Formname = Currform.Name & "!" & PassedVariable
Set Subfrm = Formname.Form
Using the above will show me the full name but when I attempt to define as a
form I get error 424 Object Required.

Any help would be appreciated
 
S

Stefan Hoffmann

hi,
I need to pass a Subforms name from a event on the form to a module which
will then fully qualify the subform name.

Public Function GetFullQualifiedName(AForm As Access.Form) As String

On Local Error Goto LocalError

GetFullQualifiedName = AForm.Parent.Name & "!" & AForm.Name

Exit Function

LocalError:
GetFullQualifiedName = AForm.Name

End Function
On event (lost focus Or wotever)
=Subform_Name("frmame")
In the event of the subform, using the form reference:

=GetFullQualifiedName(Form)
The module will then add active form and subform to give me FQ name
Currform = Screen.Activeform
Formname = Currform.Name & "!" & PassedVariable
Set Subfrm = Formname.Form
Must be

Set Subform = Forms(Formname).Form
Using the above will show me the full name but when I attempt to define as a
form I get error 424 Object Required.


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