Setting a Form Variable FROM a string

Randomblink

The Irreverent Reverend
Local time
Today, 12:31
Joined
Jul 23, 2001
Messages
279
Code:
Dim strTest As String, frmTest As Form

strTest = "frm_MainEntryForm" ' This is the NAME of the form
Set frmTest = Forms(strTest)

This is just a quick example that MOCKS my actual problem...
I can get the Form Name... even subforms within...
But... whether I get the Form Name like: strTest = "frm_ExForm"
Or whether I get the Form Name like:
strTest = "[Forms]![frm_ExForm]"

I can't set the Form variable to equal the form name I have trapped in the string...

Since I deal with forms with "sometimes" multiple subforms within subforms... can someone help me set a reference similar to the following:

[Forms]![frm_MainForm].[subfrm_FirstSubForm].[subfrm_AnotherSubForm].etc...

To a Form variable...

If you can help, you will save my neck... I have spent too many hours trying to figure out this one...

Help us Obi Won Kenobi... You're our only hope...

Thanks in advance...!!!
 
Go to the QBE and right click a field, now choose build ...

browse to the field/form you want to have. double click it...

Now you have what you are looking for. Copy/paste will then save your day :)

Regards
 

Users who are viewing this thread

Back
Top Bottom