J
Jon A
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.
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.