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.ToU pper
Case "frmDeptMapping sEdit".ToUpper
Dim aa As frmDeptMappings Edit = New frmDeptMappings Edit
open_form(aa)
Case "frmDeptMapping stable".ToUpper
Dim aa As frmDeptMappings Table = New frmDeptMappings Table
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.Messa ge)
End Try
End Sub
There has to be a better way to instantiate a form surely.
Select Case strArgument.ToU pper
Case "frmDeptMapping sEdit".ToUpper
Dim aa As frmDeptMappings Edit = New frmDeptMappings Edit
open_form(aa)
Case "frmDeptMapping stable".ToUpper
Dim aa As frmDeptMappings Table = New frmDeptMappings Table
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.Messa ge)
End Try
End Sub
Comment