Reading Database Property Values

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to be able to verify the value of a custom property for my database. I
have an application that I want to be able to set either as a single or
multi-client version, and to verify which version type it is. I am using
Access2003 and the help shows how to add and delete, but not view the value.

Thank you
 
Davina said:
I want to be able to verify the value of a custom property for my
database. I have an application that I want to be able to set either
as a single or multi-client version, and to verify which version type
it is. I am using Access2003 and the help shows how to add and
delete, but not view the value.

I don't know what type of data your "version" property is. I often set
a numeric Version property, which I retrieve like this:

'----- start of code -----
Function fncAppVersion() As String

On Error Resume Next

Dim dblVersion As Double

dblVersion =
DBEngine.Workspaces(0)(0).Containers("Databases").Documents("UserDefined
").Properties("Version")

fncAppVersion = Format(dblVersion, "0.00")

End Function

'----- end of code -----

Note: the line that actually assigns the value to dblVersion will have
been broken onto two lines by the newsreader, but it was originally all
one line.
 
Dirk,

Thank you. I will use your idea for another problem I was having. My
original question had to do with reading the Custom Tab of the Database
Properties dialog box. I discovered how to use the CreateProperty method to
add the custom property to the application and retrieve it also. This I
think is a better way of doing it since the information does not show even on
the tab, so the end-users do not have access to view it. I have included my
code below.

Public Sub setmulti() 'creates and sets property

Dim prop As Property

Set prop = CurrentDb.CreateProperty("multimc", dbBoolean, True)
CurrentDb.Properties.Append prop
End Sub

Public Sub viewmulti() 'retrieves and displays property value

MsgBox CurrentDb.Properties("multimc").Name & " = " &
CurrentDb.Properties("multimc").Value

End Sub

Public Sub multimcchange() 'Changes property value

CurrentDb.Properties("multimc").Value = False

End Sub
 
Back
Top