PDA

View Full Version : Solved: Hide Access Background



brorick
09-18-2006, 06:50 AM
I have a small pop-up form that automatically opens when the database is open. I want to hide the Access bacground when this form is active. If it was just minimized would work for me just fine. I just don't want the user to access the table data, forms and reports behind the scenes. Out of sight, out of mind. Does anyone know how I can accomplish this using either VBA or a macro? Thank you in advance.

brorick
09-18-2006, 08:16 AM
I figured this out. I can create an mde or probably goto Tools>Startup and uncheck the Display Database Window option.

asingh
09-19-2006, 02:14 AM
So what did you finally use..to disable the primary data base..I cant seem to find an option...under Tool>>Startup.....?

regards,

asingh

brorick
09-19-2006, 06:52 AM
I used the following code and it worked perfectly for my needs. I hope it helps.


Private Sub Form_Open(Cancel As Integer)
' Minimize the database window and initialize the form.
Dim dbs As Database
Dim rst As Recordset
On Error GoTo Form_Open_Err
' Minimize the database window.
DoCmd.SelectObject acForm, "Frm_Splash Quick Guide", True
DoCmd.Minimize
DoCmd.Hourglass False

Form_Open_Exit:
Exit Sub
Form_Open_Err:
MsgBox Err.Description
Resume Form_Open_Exit

End Sub

Imdabaum
09-19-2006, 07:54 AM
Another option you could do that might require a little more code and time would be to create a custom toolbar that replaces the default toolbar. Then don't include the Hide option from the Window menu option. I'll see if I can get a screen shot of what I'm talking about cause I don't do well at writing my thoughts.

Imdabaum
09-19-2006, 08:00 AM
The code would dismount the default menu and install your custom toolbar. Has there been a KB article written on this? Okay so I learned that it doesn't require a lot of code at all. Just create a Macro called AutoExec (spelling is important I think). Access automatically looks for this macro on startup regardless of how it is set up unless you know this and have programmed another macro that works around it but that would be another story.... Anyway

Create a Function in a module and insert this code


Global fToolbarsAvailable as Integer
Global fCanCustomize as Integer
Global db as Database
Function $FunctionName()
On Error Resume Next ' if you like to have error handlers this isn't much of one but ensures that the process gets carried out.
DoCmd.DoMenuItem 1, 4, 3 ' This hides the database window.
DoCmd.OpenForm "frmStartup' ' If you have a splash screen load it here.

fToolbarsAvailable= Application.GetOption("Built-in Toolbars Available")
If fToolbarsAvailable = Ture Then
Application.SetOption "Built-in Toolbars Available", False
End If
fCanCustomize= Application.GetOption("Can Customize Toolbars")
If fCanCustomize = True Then
Application.SetOption "Can Customize Toolbars", False
End If

DoCmd.Maximize
Set db= DBEngine.Workspace(0).Databases(0)

End Function



After you have created the AutoExec macro have the macro RunCode and then choose this function. It will automatically close the database window and will not allow the user the option of opening it by selecting Unhide in the Window menu option. Still the Shift key will open it up, don't know any work arounds for that... and it's probably a good thing otherwise we'd never be able to edit our code once we distributed it if we needed to do maintenance.