access database properties dialog

  • Thread starter Thread starter Guest
  • Start date Start date
Sorry: Are you asking to open that tab using VBA code, or simply to get the
values that are on it?

I don't believe it's possible to open the tab using VBA code, but you can
get at the values through code. However, note that the properties do not
exist until you've assigned them a value, so if you try simply to get at the
value of a property that hasn't been assigned, you'll get a Property Not
Found error (Error number 3270). The code below, based on an example in the
Help file, will trap that error and, in fact, insert a property with its
value set to "None" into the database so that you won't get an error the next
time.

Function GetSummaryInfo(strPropName As String) As String
On Error GoTo Err_GetSummaryInfo

Dim dbCurr As DAO.Database
Dim cntCurr As DAO.Container
Dim docCurr As DAO.Document
Dim prpCurr As DAO.Property

' Property not found error.
Const conPropertyNotFound As Long = 3270

Set dbCurr = CurrentDb
Set cntCurr = dbCurr.Containers!Databases
Set docCurr = cntCurr.Documents!SummaryInfo
docCurr.Properties.Refresh
GetSummaryInfo = docCurr.Properties(strPropName)

End_GetSummaryInfo:
Exit Function

Err_GetSummaryInfo:
If Err = conPropertyNotFound Then
Set prpCurr = docCurr.CreateProperty(strPropName, dbText, "None")
docCurr.Properties.Append prpCurr
GetSummaryInfo = "None"
Resume Next
Else
GetSummaryInfo = ""
Resume End_GetSummaryInfo
End If

End Function
 
Yeah, not possible to open right to the tab without API. However, you can
open that dialog via code:

DoCmd.RunCommand acCmdDatabaseProperties

--
Troy

Troy Munford
Development Operations Manager
FMS, Inc.
www.fmsinc.com


Sorry: Are you asking to open that tab using VBA code, or simply to get the
values that are on it?

I don't believe it's possible to open the tab using VBA code, but you can
get at the values through code. However, note that the properties do not
exist until you've assigned them a value, so if you try simply to get at the
value of a property that hasn't been assigned, you'll get a Property Not
Found error (Error number 3270). The code below, based on an example in the
Help file, will trap that error and, in fact, insert a property with its
value set to "None" into the database so that you won't get an error the
next
time.

Function GetSummaryInfo(strPropName As String) As String
On Error GoTo Err_GetSummaryInfo

Dim dbCurr As DAO.Database
Dim cntCurr As DAO.Container
Dim docCurr As DAO.Document
Dim prpCurr As DAO.Property

' Property not found error.
Const conPropertyNotFound As Long = 3270

Set dbCurr = CurrentDb
Set cntCurr = dbCurr.Containers!Databases
Set docCurr = cntCurr.Documents!SummaryInfo
docCurr.Properties.Refresh
GetSummaryInfo = docCurr.Properties(strPropName)

End_GetSummaryInfo:
Exit Function

Err_GetSummaryInfo:
If Err = conPropertyNotFound Then
Set prpCurr = docCurr.CreateProperty(strPropName, dbText, "None")
docCurr.Properties.Append prpCurr
GetSummaryInfo = "None"
Resume Next
Else
GetSummaryInfo = ""
Resume End_GetSummaryInfo
End If

End Function
 
I do not want to open the dialog box or tab. I just need the data that is
displayed from the database dialog contents tab through VBA code.
 
Back
Top