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

Close the Database Window Programatically

Status
Not open for further replies.

nuVBer

Programmer
Jul 6, 2001
63
US
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.
 
Hi

ChangeProperty "StartupShowDBWindow", dbBoolean, True

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 - UK
 
Hi nuVBer,

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

Bill




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top