Access 2002(XP) cannot hide Database Window at Startup??

  • Thread starter Thread starter pongthai
  • Start date Start date
P

pongthai

Guest
Hi,

I have set the startup property in Tools/Startup for my database with "Display Database Window" unchecked. It does actually hide the database window in MS Access 2000, however, in Access 2002(XP), the window was hidden at startup but then shown again after I click on the MS Acess taskbar.

Anyone recognize this as a bug? Are there any workaround for this?


Thanks,
Pongthai.
 
pongthai said:
Hi,

I have set the startup property in Tools/Startup for my database with "Display Database Window" unchecked. It does actually hide the database window in MS Access 2000, however, in Access 2002(XP), the window was hidden at startup but then shown again after I click on the MS Acess taskbar.

Anyone recognize this as a bug? Are there any workaround for this?


Thanks,
Pongthai.

What I do is set them on and off using Visual basic code.

That way you can turn everything off to minimum, and when you need to edit your database, turn them all back on.

Sorry about the bad code. I got it straight from the help page and I havent really read it, or formatted it. All I know is that it works.

This is your code for turning them on (or off if you use false):

Const DB_Text As Long = 10
Const DB_Boolean As Long = 1

ChangeProperty "StartupForm", DB_Text, "Login"
ChangeProperty "StartupShowDBWindow", DB_Boolean, True
ChangeProperty "StartupShowStatusBar", DB_Boolean, True
ChangeProperty "AllowBuiltinToolbars", DB_Boolean, True
ChangeProperty "AllowFullMenus", DB_Boolean, True
ChangeProperty "AllowBreakIntoCode", DB_Boolean, True
ChangeProperty "AllowSpecialKeys", DB_Boolean, True
ChangeProperty "AllowBypassKey", DB_Boolean, True
ChangeProperty "AllowShortcutMenus", DB_Boolean, True
ChangeProperty "AllowToolbarChanges", DB_Boolean, True
ChangeProperty "AllowBypassKey", DB_Boolean, True
ChangeProperty "AllowSpecialKeys", DB_Boolean, True

And this is the function you need:

Function ChangeProperty(strPropName As String, varPropType As Variant, varPropValue As Variant) As Integer
Dim dbs As Object, prp As Variant
Const conPropNotFoundError = 3270

Set dbs = CurrentDb
On Error GoTo Change_Err
dbs.Properties(strPropName) = varPropValue
ChangeProperty = True

Change_Bye:
Exit Function

Change_Err:
If Err = conPropNotFoundError Then ' Property not found.
Set prp = dbs.CreateProperty(strPropName, _
varPropType, varPropValue)
dbs.Properties.Append prp
Resume Next
Else
' Unknown error.
ChangeProperty = False
Resume Change_Bye
End If
End Function
 
Hi yhgtbfk,

Thanks for you answer. We are currently trying your suggestion.

Thanks,
Pongthai.
 
Thank you indeed my friend yhgtbfk, for showing the programmatic way of setting those DB properties, instead of using the Startup menu.

Unfortunately the original query (from pongthai) which complains that hiding Database does not work for Access 2002(XP), still sustains.

This programmatic way changes the corresponding property but, still it is not effective, like the "Startup menu" way. The “Database Window” still appears in the Windows Taskbar, as pongthai complained.

munim

What I do is set them on and off using Visual basic code.

That way you can turn everything off to minimum, and when you need to edit your database, turn them all back on.

Sorry about the bad code. I got it straight from the help page and I havent really read it, or formatted it. All I know is that it works.

This is your code for turning them on (or off if you use false):

Const DB_Text As Long = 10
Const DB_Boolean As Long = 1

ChangeProperty "StartupForm", DB_Text, "Login"
ChangeProperty "StartupShowDBWindow", DB_Boolean, True
ChangeProperty "StartupShowStatusBar", DB_Boolean, True
ChangeProperty "AllowBuiltinToolbars", DB_Boolean, True
ChangeProperty "AllowFullMenus", DB_Boolean, True
ChangeProperty "AllowBreakIntoCode", DB_Boolean, True
ChangeProperty "AllowSpecialKeys", DB_Boolean, True
ChangeProperty "AllowBypassKey", DB_Boolean, True
ChangeProperty "AllowShortcutMenus", DB_Boolean, True
ChangeProperty "AllowToolbarChanges", DB_Boolean, True
ChangeProperty "AllowBypassKey", DB_Boolean, True
ChangeProperty "AllowSpecialKeys", DB_Boolean, True

And this is the function you need:

Function ChangeProperty(strPropName As String, varPropType As Variant, varPropValue As Variant) As Integer
Dim dbs As Object, prp As Variant
Const conPropNotFoundError = 3270

Set dbs = CurrentDb
On Error GoTo Change_Err
dbs.Properties(strPropName) = varPropValue
ChangeProperty = True

Change_Bye:
Exit Function

Change_Err:
If Err = conPropNotFoundError Then ' Property not found.
Set prp = dbs.CreateProperty(strPropName, _
varPropType, varPropValue)
dbs.Properties.Append prp
Resume Next
Else
' Unknown error.
ChangeProperty = False
Resume Change_Bye
End If
End Function
 
Hi Pongthai and Yhgtbfk

I got a solution from another forum and it works for “MS Access 2002” too! I have merged two functions into one to do both hiding and unhiding the Database Window.


Public Sub HideDBWindow(hide As Boolean)
If hide Then
With DoCmd
.SelectObject acTable, " OneTableName ", True
.RunCommand acCmdWindowHide
End With
Else
DoCmd.SelectObject acTable, "OneTableName", True
End If
End Sub


But I usually keep all the tables hidden (programmatically), therefore I have to unhide a table than apply above code. To avoid that I have written the following code which too works. I created a blank macro! which does not work at all, but can be used for our purpose, i.e. hiding/unhiding DB window. See the code below:

Public Sub HideDBWindow(hide As Boolean)
If hide Then
With DoCmd
.SelectObject acMacro, "dummymacro", True
.RunCommand acCmdWindowHide
End With
Else
DoCmd.SelectObject acMacro, "dummymacro", True​
End If
End Sub



Best Regards,

munim


Hi,

I have set the startup property in Tools/Startup for my database with "Display Database Window" unchecked. It does actually hide the database window in MS Access 2000, however, in Access 2002(XP), the window was hidden at startup but then shown again after I click on the MS Acess taskbar.

Anyone recognize this as a bug? Are there any workaround for this?


Thanks,
Pongthai.
 
Glad you found a solution and posted your results. I am surprised you did not find the answer in this forum if you searched for "hide database window". My old thread has lots of stuff on how to hide things... Hide all Access Toolbars and Menubars including the database window.
 
thanks a lot, actually i was searching number of forums in parallel and didn’t attempt that here or missed some how. your link is a very good where following two were particularly helpful for me (and surely others)

Application.CommandBars.DisableAskAQuestionDropdown = True
Application.SetOption "ShowWindowsinTaskbar", False

Your post recommends to visit http://www.access-programmers.co.uk/forums/showthread.php?t=63576 before further inquiries, but that link does not exist.

thanks again.

munim


Glad you found a solution and posted your results. I am surprised you did not find the answer in this forum if you searched for "hide database window". My old thread has lots of stuff on how to hide things... Hide all Access Toolbars and Menubars including the database window.
 

Users who are viewing this thread

Back
Top Bottom