-
August 9th, 2023, 11:13 PM
#1
Dynamically Create Object Name - RESOLVED
I think I have done this previously, but cant seem to lay my hands on how I did it.
I have a number of forms which are named frmOrd1, frmOrd2, frmOrd3 ...... frmOrd100
I need to be able to access any form randomly and would like to do something like this
HTML Code:
THIS DOES NOT WORK BUT IS WHAT I WOULD LIKE TO DO
Key in a number 1-100 and allocate it to a variable eg FormNumber
then ............
FormName = "frmOrd" & FormNumber 'FormName might now be "frmOrd53"
Load FormName
Last edited by George1111; August 9th, 2023 at 11:56 PM.
Reason: RESOLVED
-
August 9th, 2023, 11:52 PM
#2
Re: Dynamically Create Object Name - RESOLVED
 Originally Posted by George1111
I think I have done this previously, but cant seem to lay my hands on how I did it.
I have a number of forms which are named frmOrd1, frmOrd2, frmOrd3 ...... frmOrd100
I need to be able to access any form randomly and would like to do something like this
HTML Code:
THIS DOES NOT WORK BUT IS WHAT I WOULD LIKE TO DO
Key in a number 1-100 and allocate it to a variable eg FormNumber
then ............
FormName = "frmOrd" & FormNumber 'FormName might now be "frmOrd53"
Load FormName
I have an answer to the problem by ahenry in VBForums !
Code:
FormName = "frmOrd" & "02"
Set NewForm = Forms.Add(FormName)
NewForm.Show ' Shows frmOrd02
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|