Hi All. On the close event of many of my forms i have a case statement to
select which form to return to.
I will be using the same code on several different forms and am sure that
this code can be stored in a module but I don't know how to save/call the
module.
Select Case me.openargs
Case 1, 2
Forms!frmMain.visible = true
Case 3,4
Forms!frmManagermain.visible = true
Case 5
Forms!frmUserMain.visible = true
End Select
Thanks in advance
Enjoy the weekend
Dennis - 27 May 2005 14:21 GMT
On the modules tab click new and then type in the following. Click the save
button on the toolbar and call the module anything you like.
In the close event of your forms, replace your existing code with
Goto_Which_Form(Me.openargs)
Function Goto_Which_Form(nArgs as Integer)
Select Case nArgs
Case 1, 2
Forms!frmMain.visible = true
Case 3,4
Forms!frmManagermain.visible = true
Case 5
Forms!frmUserMain.visible = true
End Select
End Function
> Hi All. On the close event of many of my forms i have a case statement to
> select which form to return to.
[quoted text clipped - 14 lines]
> Thanks in advance
> Enjoy the weekend
Randy Harris - 27 May 2005 14:26 GMT
> Hi All. On the close event of many of my forms i have a case statement to
> select which form to return to.
[quoted text clipped - 14 lines]
> Thanks in advance
> Enjoy the weekend
What you can do, is store it as a procedure in a module. For example, you
could call the procedure ShowForm, then in a module, you would create the
procedure:
Public Sub ShowForm (Arg as Integer)
Select Case Arg
Case 1, 2
Forms!frmMain.visible = true
Case 3,4
Forms!frmManagermain.visible = true
Case 5
Forms!frmUserMain.visible = true
End Select
End Sub
Then to call it from a Close Event, or wherever, you would use:
ShowForm 2
HTH,
Randy