[AccessD] Forgotten syntax

Heenan, Lambert Lambert.Heenan at chartisinsurance.com
Wed Sep 9 10:13:35 CDT 2009


PS.

Assuming that  Parent.GetResults_LC1_Check does not work (though it probably will) then you can make the procedure call in the sub form independent of the parent form's name by calling it this way...

Forms(Parent.Name).GetResults_LC1_Check

Which means the call will still work even if you happen to change the name of the parent form.

Also note that the use of the keyword 'Call' is entirely optional - you might even say deprecated, and you also do not need to use the keyword Me. For example Me.Parent and Parent return references to exactly the same form object.

Lambert


-----Original Message-----
From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Heenan, Lambert
Sent: Wednesday, September 09, 2009 10:57 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Forgotten syntax

Because the code module of a form is a class module you need to make that procedure (which is really a class method) public with...

Public Sub GetResults_LC1_Check
<code>
End Sub

You will then be able to call the routine from anywhere with...

Forms!YourForm.GetResults_LC1_Check

And you *might* be able to call it with Parent.GetResults_LC1_Check from within the sub form.

HTH

Lambert

-----Original Message-----
From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Arthur Fuller
Sent: Wednesday, September 09, 2009 10:31 AM
To: Access Developers discussion and problem solving
Subject: [AccessD] Forgotten syntax

I have a form containing a subform, from which I want to call a procedure that lives in the parent form. The syntax I am using is:
<vba>
Call Me.Parent.Form.GetResults_LC1_Check
</vba>

The procedure is also called directly on the parent form, where it works fine, but when called from the subform it errors out (Application-defined or object-defined error in procedure ...)

I recall once seeing a document describing all the various syntax references to Access objects. Anyone know where that lives?

TIA,
Arthur
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list