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

ADO vs DAO code for Database Properties

Status
Not open for further replies.

vbprgmr

Programmer
Dec 22, 2002
8
US
Need help!
I'm looking for the ADO equivalent of the following DAO code
(which interrogates the 'Database Properties' collection).

Ex: lStr = gfGetDBSProp("Summary","Author")

'
Public Function gfGetDBSProp(lpDoc As String, lpPrp As String) As String
Dim dbs As Database, cnt As Container
Dim doc As Document, prp As Property
Const conPropertyNotFound = 3270

On Error GoTo gfGetProp_Err
Set dbs = CurrentDb
Set cnt = dbs.Containers!Databases
Select Case lpDoc
Case Is = "Custom"
Set doc = cnt.Documents!UserDefined
Case Is = "Summary"
Set doc = cnt.Documents!SummaryInfo
Case Is = "General"
Set doc = cnt.Documents!generalinfo
End Select
doc.Properties.Refresh
gfGetDBSProp = doc.Properties(lpPrp)

gfGetProp_Bye:
Exit Function

gfGetProp_Err:
If Err = conPropertyNotFound Then
gfMsgBox "dbs Properties:" & lpPrp & " not found"
Resume gfGetProp_Bye
End If
End Function
'
-------------------------------
Any help would be appreciated!

vbprgmr [dazed]
 
Hello,
you have to change your dims. you need something like this -->
Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim tbl As New ADODB.Recordset
Dim dbcmd As ADODB.Command

Set cnn = New ADODB.Connection
Set rst = New ADODB.Recordset
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = c:\Problemverwaltung\outlook.mdb"

Hope this helps
Mark
 
Thanks, Mark.
I'll give it a try and let you know.
I'll be out of town for a few days, but will let you know ASAP.

Thanks again!
vbprgmr
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top