Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / New Users / May 2005

Tip: Looking for answers? Try searching our database.

Modules/Procedure

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Chris - 27 May 2005 12:07 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.