Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Going back to Switchboard from a form

Status
Not open for further replies.

tdenitti

MIS
Aug 24, 2001
68
US
I created a database to house our IT inventory. All the forms are how I want them, relationships and so on. I have just recently created a switchboard as an interface to the database. What I am having problems with now is going back to the switchboard from a form. For example, if a user selects the 'Add a Printer' button from the switchboard, it takes him to the Printers form to add a new record. What I would like to have happen is that once the user enters in all the information, I would like to have a button or some other command to be able to take them back to the switchboard again. Is this possible? I am no guru by any means and this is driving me up a wall. Any of your help would be greatly appreciated. Thanks a lot in advance
 
You can utilize the OnClose Event of the Printerform to open the switchboard. Better not to close the switchboard minimize it instead. Then restore it after closing the printer form. So you can have a check If the switchboard is loaded then restore it.

Zameer Abdulla
Visit Me (New Look & style)
 
Thank you ZmrAbdulla for the quick response. That is a good idea. Any ideas on how to go about coding something like that? Unfortunately I am not a programming guru either. Life would be a lot easier if I were though. Thanks again!
 
Hi tdenitti

You need to create at least two macros to start off with....

the first macro enter the following

action properties setting

minimize
open form form Name NameOfYourPrinterForm


and save that as something like "minimize N open"

On the second macro enter the following

action properties setting

Close
open form form Name NameOfYourSwitchboardForm

and save this as something like "CloseOther N OpenSwitch".
Now goto the switchboard form and in design view click on the button which opens the printer form and view its properties. click on the 'on click' property and select the 'minimize N open' macro from the pulldown menu.
Save this form
open the printer form and click on the button which CLOSES or the user clicks when they have finish with the printer form, view its properties. click on the 'on click' property and select the 'CloseOther N OpenSwitch' macro from the pulldown menu.
Save this form.

There we go... and without any coding either.

Program Error
Programmers do it one finger at a time!
 
I don't prefer any macro to be used in the application due to no error handling in it.
Here is a code I use in a db. modified the form / command names.
Switchboard form
Code:
Private Sub cmdOpenPrinter_Click()
On Error GoTo Err_cmdOpenPrinter_Click
    DoCmd.Minimize
    Dim stDocName As String
    Dim stLinkCriteria As String
    
    stDocName = "frmPrinter"
    DoCmd.OpenForm stDocName, , , stLinkCriteria
   
Exit_cmdOpenPrinter_Click:
    Exit Sub

Err_cmdOpenPrinter_Click:
    MsgBox Err.Description
    Resume Exit_cmdOpenPrinter_Click
    
End Sub
'========================
Private Sub Form_Activate()
    DoCmd.Restore
End Sub
Printer form
Code:
Private Sub Form_Close()
    If CurrentProject.AllForms("frmSwitchboard").IsLoaded = True Then
        Forms!frmSwitchboard.SetFocus
    Else
        DoCmd.OpenForm "frmSwitchboard"
    End If
End Sub
Some one may not need the IsLoaded check. Open the Switchboard directly.

Zameer Abdulla
Visit Me (New Look & style)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top