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

VBA to turn off Database Window

Status
Not open for further replies.

brettatexplace

Technical User
Mar 8, 2002
60
CA
What's the object called that controls the Database window (ie. the thing that comes up when you press F11 with tabs for Tables,Queries,Forms,Report,Modules).
I have it hidden on start-up but then when I use VBA to print a form, the thing pops up and stays up, but I want to hide it again. THis should be simple but I can't find it.
 
Alright, I know that this is totally "UNELEGEANT" but I got it to work. Ugly that works sometimes has to do. Will figure a better way to do this and post later.

If you have your form open and then the database window opens up then try this code wherever you trigger the running the VBA code to print a form:

Dim frmCurrentForm As Form
Set frmCurrentForm = Screen.ActiveForm
DoCmd.SelectObject acForm, frmCurrentForm.Name
DoCmd.RunCommand acCmdWindowHide
DoCmd.RunCommand acCmdWindowHide
DoCmd.SelectObject acForm, "frmYourFormName"

Seems to work so play with a little and see if you can improve on it.

Bob Scriver
 
I found this after extensive digging through the Access 97 Help files:


To Hide Database Window ( Sometimse I put this in the On Open Event of the first form to open):

Code:
Private Sub HideDatabaseWindow()
DoCmd.SelectObject, acTable, True
DoCmd.RunCommand acCmdWindowHide
End Sub
Code:
To Unhide Database Window: (sometimse I use a command button on a form to run this)

Code:
Private Sub UnHideDatabaseWindow()
'Put code here to close the current form if desired
'DoCmd.Close acForm, Me.Name
DoCmd.SelectObject, , True
End Sub
Code:

Hope you find this useful
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top