I wish to open a form using a variable derived from a table. The Application is based on the switchboard principle from Access. However in the absence of do.cmd openForm, I have to use this code.
There has to be a better way to instantiate a form surely.
Select Case strArgument.ToUpper
Case "frmDeptMappingsEdit".ToUpper
Dim aa As frmDeptMappingsEdit = New frmDeptMappingsEdit
open_form(aa)
Case "frmDeptMappingstable".ToUpper
Dim aa As frmDeptMappingsTable = New frmDeptMappingsTable
open_form(aa)
....
Private Sub open_form(ByVal frmToOpen As Form)
Try
frmToOpen.Top = 10
frmToOpen.Left = 10
frmToOpen.Owner = Me
frmToOpen.Show()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub