txgeekgirl
Registered User.
- Local time
- Today, 09:27
- Joined
- Jul 31, 2008
- Messages
- 187
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
The best that I can do so far is get the form as an “AccessObject” data type with this:
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:
I need this to work:
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:
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:
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:
Dim obj as AccessObject
Set obj = CurrentProject.AllForms(mystringvar)
This works (because the form is open:
Code:
[SIZE=3][FONT=Calibri]Dim myform as form[/FONT][/SIZE]
Myform = me.form
Dummy = Fixform(myform)
I need this to work:
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:
[COLOR=#1f497d][COLOR=#1f497d]Set myform = Forms(mystring).form[/COLOR]
[/COLOR]