form.show using a variable name
Posted on 1998-06-11
One of my programmers is trying to load a form using a variable instead of hardcoding the form name into the procedure. She is getting the form name from a table. The documentation says to me that you can't use the load method with a variable instead of the form object.
Here is her code.
Private Sub DBGrid1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim MyString As String
On Error GoTo ErrorSection
IgColumn = DBGrid1.ColContaining(X)
IgRow = DBGrid1.RowContaining(Y)
VargBookmark = DBGrid1.RowBookmark(IgRow)
FileMnu.Menu_Item = DBGrid1.Columns(IgColumn).CellValue(VargBookmark)
FileMnu.Menu_Module = DBGrid1.Columns(1).CellValue(VargBookmark)
lblMenu = FileMnu.Menu_Item
lblModule = FileMnu.Menu_Module
MyString = CStr(lblModule) ' Create text string.
frm3 = Mid(MyString, 1, 3) ' Returns "warehouseNO".
If frm3 = "frm" Then
'MsgBox "Menu_Module empty. Should be calling form, workpad etc."
MyString = lblModule ' Initialize string.
Nmefrm = Trim(MyString) 'trim spaces
Stepping thru the code I can see that the variable contains her form name, but VB doesn't like Nmefrm.Show
Is there a way to do this?