Can I set a variable reference to a form that is referenced by a variable?
From: Jon A (JonA_at_wi.rr.com)
Date: 02/26/05
- Next message: Bill: "Re: Runtime Error?"
- Previous message: mrsr84: "Created options group with toggle buttons but can't find stored in"
- Next in thread: Albert D. Kallal: "Re: Can I set a variable reference to a form that is referenced by a variable?"
- Reply: Albert D. Kallal: "Re: Can I set a variable reference to a form that is referenced by a variable?"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 26 Feb 2005 00:36:58 GMT
I have a Public function that is called from a number of
different forms. One of the things this function does is to
open a form whose FormName is passed as a parameter into the
function.
I can open the form that is referenced by that variable
easily enough by using the following DoCmd statement.
However, when I try to use SET as shown below I get runtime
errors saying that the form "strTheForm" cannot be found.
Public Function LoadQualityFactors(varTheReviewID As
Variant, strTheForm As String) As Boolean
DoCmd.OpenForm strTheForm
Set frmTheForm = Forms![strTheForm]
end Function
I find that I can open the referenced form only by including
the actual form name in the brackets such as
Set frmTheForm = Forms![frm_DisplayQualityFactors]
The problem I have is that this function is useful for a
number of different forms that I have built and I don't want
to have to code every form name into the function. I thought
it would be possible to use variable references to point to
the different forms.
Can anyone tell me what the correct syntax is? I have
searched MSDN and cannot find a thing.
- Next message: Bill: "Re: Runtime Error?"
- Previous message: mrsr84: "Created options group with toggle buttons but can't find stored in"
- Next in thread: Albert D. Kallal: "Re: Can I set a variable reference to a form that is referenced by a variable?"
- Reply: Albert D. Kallal: "Re: Can I set a variable reference to a form that is referenced by a variable?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|