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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ms access code builder

Status
Not open for further replies.

jrmachine

Technical User
Sep 28, 2005
3
US
I have a code that I need help with. I want to have a command button that will open a seperate form, after it opens, I would like for the original form to automatically close. the form is basically a splash form for entering a database, but it has two command buttons, Open_Main_Click and Exit_System_click. the first opens to the main menu of the database, and the second one closes the system. does anyone have any ideas on how to make it work. It would seem like a simple procedure but the if....then controls havent worked thus far. If you need more info, then I will get it for you. Thanx

ps: the open_form_click code is

private Sub Open_Main_Click()
On Error GoTo Err_Open_Main_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Main Page"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Open_Main_Click:
Exit Sub

Err_Open_Main_Click:
MsgBox Err.Description
Resume Exit_Open_Main_Click

End Sub
 
Code:
private Sub Open_Main_Click()
On Error GoTo Err_Open_Main_Click

          Dim stDocName As String
          Dim stLinkCriteria As String
     
          stDocName = "Main Page"
          DoCmd.OpenForm stDocName, , , stLinkCriteria
          DoCmd.Close acForm, Me.Name
Exit_Open_Main_Click:
          Exit Sub

Err_Open_Main_Click:
          MsgBox Err.Description
          Resume Exit_Open_Main_Click

End Sub

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
but then, the second button is -at best- of limited value without a LOT more code. Since the "Spash Screen" form is CLOSED if / when the other form (switchboard) is iopened, the only way back to the close thing (command button) is to reopen the spalash screen from elsewhere. While this is obviously possible, it is also a long way around to simply close the app.

A more common approach is to just hide the "Splash" screen and have is un-hidden when other forms are not active.



MichaelRed


 
I assumed:
1) the switchboard had a quit application button
2) the quit button on the splash was just in the event the user really didn't want to run the application.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top