C
cinnie
hi to all
I am writing a function whose parameters are the form that is active when
the function is called (frmFROM), and the form that the function then opens
(frmTO).
My problem is that the frmTO is used as a string in line 5 and 8, but as a
form in line 6. Whichever way I Dim frmTO, I get a crash. How can reslove
this problem?
1 Function ReturnToMenu(frmFROM As Form, frmTO As String)
2 frmFROM.Visible = False
3 Dim prj As Object
4 Set prj = Application.CurrentProject
5 If prj.AllForms(frmTO).IsLoaded Then
6 Forms!frmTO.Visible = True
7 Else
8 DoCmd.OpenForm frmTO
9 End If
10 .....
much thanks
I am writing a function whose parameters are the form that is active when
the function is called (frmFROM), and the form that the function then opens
(frmTO).
My problem is that the frmTO is used as a string in line 5 and 8, but as a
form in line 6. Whichever way I Dim frmTO, I get a crash. How can reslove
this problem?
1 Function ReturnToMenu(frmFROM As Form, frmTO As String)
2 frmFROM.Visible = False
3 Dim prj As Object
4 Set prj = Application.CurrentProject
5 If prj.AllForms(frmTO).IsLoaded Then
6 Forms!frmTO.Visible = True
7 Else
8 DoCmd.OpenForm frmTO
9 End If
10 .....
much thanks