i've got a brainteaser for you guys. let's say i have a form called "Form1"...
now, i have a lot of fields on Form1 and get tired of typing out forms!form1.fillintheblank.value because they are referenced quite a bit. so i want to create a function that will fill in the blank and return the value that resides in that location. the problem is, once it is converted to string (in order to use concatenation) i can't seem to convert it back to a true variant. it always retains the form of a string. take this for example:
the output of Permissions("He llo") is:
[Forms]![Form1].[Hello].value
i would much rather have the output be whatever value is in that field :)
is there any possible way around this? i've thrown the kitchen sink at this problem and i've got nothing. any suggestions? thanks guys.
--nate
now, i have a lot of fields on Form1 and get tired of typing out forms!form1.fillintheblank.value because they are referenced quite a bit. so i want to create a function that will fill in the blank and return the value that resides in that location. the problem is, once it is converted to string (in order to use concatenation) i can't seem to convert it back to a true variant. it always retains the form of a string. take this for example:
Code:
Function Permissions(Root As String)
Dim strRoot As String
Dim varRoot As Variant
strRoot = "[Forms]![Form1].[" & Root & "].value"
varRoot = (CVar(strRoot)
If CurrentProject.AllForms("Form1").IsLoaded Then
Permissions = Nz(varRoot, 0)
Else: Permissions = 0
End If
Debug.Print Permissions
End Function
[Forms]![Form1].[Hello].value
i would much rather have the output be whatever value is in that field :)
is there any possible way around this? i've thrown the kitchen sink at this problem and i've got nothing. any suggestions? thanks guys.
--nate
Comment