Get ADP Custom Database Property - Document Number Value ** $100 To Any Can Do It...

C

cj_008

Get ADP Custom Database Property - Document Number Value ** $100 To
Anybody Can Do It... i don't care if it takes you 15 seconds...

We will pay $100 dollars to any programmer who can GET the Document
Number value from the Database Properties area of an ADP & ADE (Access
2000 and up file format) from A VB PROJECT...

See this link to a screen shot for any clarification you might need on
exactly what part of the ADP file i am babbling about... Database
Properties - Custom Tab - Document Number Value

http://www.enflow.com/ScreenShotADP.htm

Chris James
831-649-4659
Monterey, CA.
 
S

Sylvain Lafontaine

These properties are not directly 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. » .

A possible solution would be to use the DsoFile.dll library, however, I
don't know if it will work with ADP and ADE:

http://www.microsoft.com/technet/community/columns/scripts/sg0305.mspx

Please answer back if you try it to tell us if it has worked or not.
 
C

cj_008

Thanks Sylvain, for taking the time to answer and adding some
interesting info about VB projects and database properties in ADPs &
ADEs -

I will look into your link and that library too... if i get any joy i
will report back...

cj...
 
S

Sylvain Lafontaine

Database Properties and Custom Database Properties are not exactly the same
thing. You can set and get database properties but they won't show up in
the cute little dialog window:

Private Const cerrPropertyNotFound As Integer = 2455

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

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:
' Err_Handler: utilisée dans l'ancienne version.

Select Case err
Case cerrPropertyNotFound
db.Properties.Add strPropName, varPropValue

Case Else
' Call LogError(Err.Number, Err.Description, cModuleName &
cProcedureName)
End Select

Resume Exit_Sub

End Sub

' GetProperty() will return True if it find the property or else will
return False.
' The property iteself is returned as the argument strPropValue.

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

' Property not found.
GetProperty = False

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

Err_Handler:
GetProperty = False

Select Case err
Case cerrPropertyNotFound
Case Else
' Call LogError(Err.Number, Err.Description, cModuleName &
cProcedureName)
End Select

Resume Exit_Function

End Function
 
V

Vadim Rapp

Hello (e-mail address removed),
You wrote in conference microsoft.public.access.adp.sqlserver on 4 Feb 2006
09:16:01 -0800:

c> Get ADP Custom Database Property - Document Number Value ** $100 To
c> Anybody Can Do It... i don't care if it takes you 15 seconds...


1. download OLE object from http://support.microsoft.com/Default.aspx?kbid=224351
and regsvr32 the library..

2. The download will have VB6 sample; it won't 100% work with ADP file, but
the following essential code will do what you want:

Dim m_oDocumentProps As DSOFile.OleDocumentProperties
Set m_oDocumentProps = New DSOFile.OleDocumentProperties
m_oDocumentProps.Open "myadp.adp", True,
dsoOptionOpenReadOnlyIfNoWriteAccess
MsgBox m_oDocumentProps.CustomProperties("document number")
m_oDocumentProps.Close

Note that with this library, your program won't even have to call Access to
open the ADP project, it reads the properties directly from the file.


regards,

Vadim Rapp
 
V

Vadim Rapp

Hello Sylvain,
You wrote in conference microsoft.public.access.adp.sqlserver on Sat, 4 Feb
2006 23:49:01 -0500:

SL> Database Properties and Custom Database Properties are not exactly the
SL> same thing.

I think the properties on these pages are not related to the database. Those
are custom file properties, similar to version info of the exe file, and the
interface to deal with that is called IFilter. It's the same thing that
shows bitrate of mp3 file or shutter value of the digital picture in the
status bar of the window in explorer, and they are available as columns in
folder's detailed view (if you customize it). An application can register
new custom properties with Windows, and then use them through that
interface. The complete list of all registered properties is visible in
computer management/indexing service/system/properties. There's an article
about it and other shell enhancements at http://msdn.microsoft.com/msdnmag/issues/01/11/XPShell/

Vadim Rapp
 
S

Sylvain Lafontaine

Bad choice of words of my part here. I wasn't refering to the backend SQL
database but to the fact that with MDB, you have a direct VBA access to all
properties that can be set programmatically or by the properties windows but
that with ADP, you have access to only a subset of these properties.

As we don't know what the OP want to do with these properties, I've added
this piece of information just in case.
 
D

david epsom dot com dot au

In an mdb, "Custom Database Properties" are

db.Containers("databases").Documents("UserDefined").Properties

and "Database Properties" are
db.Containers("databases").Documents("MSysDb").Properties

which is the same as
db.Properties

ie MSysDb is the default document of the default container, and, in an MDB,
both kinds of properties are the same kind of object (dao.property)

Obviously, not the same in this context.

(david)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top