txgeekgirl1
Programmer
I have a string that contains the name of a form, something like “Update Requests 1”. It has to start as a string because the digit at the end will change based on user interaction. The digit could be up to 99 so a giant case statement is unmanageable.
I need to populate a variable of data type “form” with a reference to this form so that I can feed it to a function that requires a parameter of type “form”. The function call is something like
Code:
The best that I can do so far is get the form as an “AccessObject” data type with this:
Code:
At that point I can display the “name” property of the object, so I know that the string is populated properly. How do I use the string to create a variable of “form” data type?
This works (because the form is open:
Code:
I need this to work:
Code:
Tried to set the string to the form reference and got an error that it couldn't reference a form that didn't exist - even though the form does exist using this:
Code:
Thanks for the help.
I need to populate a variable of data type “form” with a reference to this form so that I can feed it to a function that requires a parameter of type “form”. The function call is something like
Code:
Code:
Dummy = Fixform(myformname)
' Where the function definition is
Function Fixform(pform as form) as boolean
The best that I can do so far is get the form as an “AccessObject” data type with this:
Code:
Code:
Dim obj as AccessObject
Set obj = CurrentProject.AllForms(mystringvar)
At that point I can display the “name” property of the object, so I know that the string is populated properly. How do I use the string to create a variable of “form” data type?
This works (because the form is open:
Code:
Code:
Dim myform as form
Myform = me.form
Dummy = Fixform(myform)
I need this to work:
Code:
Code:
Dim myString as string
Dim mynum as integer
Mynum = 1
Mystring = “Update Requests “ + TRIM(STR(mynum))
Dummy = Fixform(mystring)
Tried to set the string to the form reference and got an error that it couldn't reference a form that didn't exist - even though the form does exist using this:
Code:
Code:
Set myform = Forms(mystring).form