Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / SQL Server / ADP / December 2005

Tip: Looking for answers? Try searching our database.

How to get and set Custom Database properties in ADP?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bill - 06 Dec 2005 19:54 GMT
Most of my MDB upsized ok but I cannot figure out how to read some custom
database properties that I use.

Example

   'read version from Database, Properties, Custom
   Set dblocal = CurrentDb()
   myDBVersion = GetDatabaseProp(dblocal, "Version")

using:

Function GetDatabaseProp(dbDatabase, strPropertyName As String) As Variant
     GetDatabaseProp =
dbDatabase.Containers!Databases.Documents("UserDefined").Properties(strPropertyName).Value
End Function

This is proabably because there is no DAO jet DB any more!

So how do I do I point to the equivalent Custom Properties in the ADP?

Thanks

Bill
Sylvain Lafontaine - 06 Dec 2005 20:06 GMT
For ADP:

Public Sub SetProperty( _
   ByVal strPropName As String, _
   ByVal varPropType_Bidon As Integer, _
   ByVal varPropValue As Variant)

   Const cProcedureName As String = "SetProperty"
   On Error GoTo Err_Handler

   Dim db As CurrentProject
   Set db = Application.CurrentProject

   ' Properties are string values.
   If (IsNull(varPropValue)) Then varPropValue = ""

   Dim i
   For i = 0 To db.Properties.Count - 1
       If (db.Properties(i).name = strPropName) Then
           db.Properties(strPropName).Value = varPropValue
           GoTo Exit_Sub
       End If
   Next

   db.Properties.Add strPropName, varPropValue

Exit_Sub:
   On Error GoTo 0
   Set db = Nothing
   Exit Sub

Err_Handler:

   ''''' Call LogError(Err.Number, Err.Description, cModuleName &
cProcedureName)
   Resume Exit_Sub

End Sub

   ' GetProperty(): returns TRUE if the property was already known; FALSE
otherwise.
   ' The value itself is passed by argument.

Public Function GetProperty( _
   ByVal strPropName As String, _
   ByRef strPropValue As Variant) As Boolean

   Const cProcedureName As String = "GetProperty"
   On Error GoTo Err_Handler

   Dim db As CurrentProject
   Set db = Application.CurrentProject

   Dim i
   For i = 0 To db.Properties.Count - 1
       If (db.Properties(i).name = strPropName) Then
           strPropValue = db.Properties(strPropName)
           GetProperty = True
           GoTo Exit_Function
       End If
   Next

   GetProperty = False

Exit_Function:
   On Error GoTo 0
   Set db = Nothing
   Exit Function

Err_Handler:
   GetProperty = False
   ''''' Call LogError(Err.Number, Err.Description, cModuleName &
cProcedureName)
   Resume Exit_Function

End Function

Signature

Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: http://cerbermail.com/?QugbLEWINF

> Most of my MDB upsized ok but I cannot figure out how to read some custom
> database properties that I use.
[quoted text clipped - 19 lines]
>
> Bill
Bill - 06 Dec 2005 20:34 GMT
Thanks,

I looked at this and it still does seem quite right.

Sure this code does add properties that I can then read back with

For Each prop In CurrentProject.Properties
Debug.Print prop.Name
Next prop

But they do not appear in the Custom tab of Database Properties dialog

So where are those Custom Properties?

Thanks

Bill

> For ADP:
>
[quoted text clipped - 97 lines]
>>
>> Bill
Sylvain Lafontaine - 06 Dec 2005 23:47 GMT
Oups, sorry, I misread your question.

I'm sorry but these properties are not available from an Access ADP project.
This is also documented in the Help File: search for "database properties"
and you find the following note: « The Database properties of a Microsoft
Access project (.adp) are not available using Visual Basic. »

Signature

Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: http://cerbermail.com/?QugbLEWINF

> Thanks,
>
[quoted text clipped - 115 lines]
>>>
>>> Bill
Bill - 07 Dec 2005 13:51 GMT
Hmmm.
Sounds like a bug to me.

Anyway, the approach you suggested will work, and if I use a form then I
will be able change them without resorting to code.

Thanks

Bill

> Oups, sorry, I misread your question.
>
[quoted text clipped - 122 lines]
>>>>
>>>> Bill
Sylvain Lafontaine - 10 Dec 2005 22:15 GMT
Maybe http://www.microsoft.com/technet/community/columns/scripts/sg0305.mspx 
.

Signature

Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: http://cerbermail.com/?QugbLEWINF

> Hmmm.
> Sounds like a bug to me.
[quoted text clipped - 132 lines]
>>>>>
>>>>> Bill
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.