Anyone know what the code would look like to close the Database Window? I know you can do it with the startup utility, but I want it to be controlled by code.
Function ChangeProperty(strPropName As String, varPropType As Variant, varPropValue As Variant) As Integer
Dim dbs As DAO.Database, prp As Property
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
HandleErrorMsg Err.Description, Err.Number, "ChangeProperty", "frmSwitchboard"
Resume Change_Bye
End If
End Function
Regards
Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now -
This will hide the DB Window:
On Error Resume Next
DoCmd.Echo False
DoCmd.SelectObject acTable, , True
DoCmd.RunCommand acCmdWindowHide
DoCmd.Echo True
This will unhide the DB Window:
On Error Resume Next
DoCmd.Echo False
DoCmd.SelectObject acTable, , True
Me.SetFocus 'Delete this line if you want set focus to the DB Window
DoCmd.Echo True
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.