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

Hi guys - I am trying to extract i

Status
Not open for further replies.

JohnBates

MIS
Feb 27, 2000
1,995
0
0
US
Hi guys -
I am trying to extract information about my Access 2000 db because I may have to analyze and rewrite most of it.
I'm referencing the properties of the containers and documents within the db and well, I'm a little over my head.

I'm getting a Type mismatch error as I try to loop thru the property values..... see the code below that is blocked-off with asterisks.

Thanks for your help. John


Sub PrintObjectProperties(strObjectType As String, strObjectName _
As String)
Dim dbs As Database, ctr As Container, doc As Document
Dim intI As Integer
Dim strTabChar As String
Dim prp As Property

Set dbs = OpenDatabase("D:\Custord\Menlo2000.mdb")

strTabChar = vbTab
' Set Container object variable.
Set ctr = dbs.Containers(strObjectType)
' Set Document object variable.
Set doc = ctr.Documents(strObjectName)
doc.Properties.Refresh
' Print the object name to Debug window.
Debug.Print doc.Name
' Print each Object property to Debug window.

'**** This is where the Error 13 Type mismatch occurs *****
For Each prp In doc.Properties
'**********************************************************

Debug.Print strTabChar & prp.Name & " = " & prp.Value
Next
End Sub
 
Is there more than one PROPERTY object in your project. In my project, I have both WORD Type library and the Scriprting object. Both have a DICTIONARY OBJECT so I Use
Dim dctD as Scripting.Dictionary.

Here' a fast way. Type
Dim prp As Prope and then press CTRL-Space (AutoComplete).
If you get a list with two or entris for PROPERTY then you have that problem.

You can PRESS PF2 to use the object browser and fish around for the correct Project (e.g. Scripting) name for the PROPERTY.


 
I have used the properties collecition of the database object and that works fine with DAO 3.6 and Access 2000. The problem might be the Doc object properties collection. It should work, but it could be a bug. Have you check microsoft? Try not to declare the prp varible as property. I have had problem with types and collections in the past. If leave as a varient sometime you can get around the type mismatch.
 
Thanks for your suggestions, guys.

John I tried Dim prp As doc.Properties but get
Compile error: User-defined type not defined

did learn alot bu looking in the object browser to see
what members are associated with these classes.

Pistol34, I tried Dim prp As Variant.... did not help
I am using DAO 3.6 and Access 2000

**********************************************************
Here is my code as it now looks....have had several diff errors along the way... but I now get the error I originally
posted about: Error 13 - Type mismatch I'm running in circles
**********************************************************
Thanks, John



Sub PrintObjectProperties(strObjectType As String, strObjectName _
As String)
Dim dbs As Database, ctr As Container, doc As Document
Dim intI As Integer
Dim strTabChar As String
Dim prp As doc.Properties
'Dim prp As Properties
'Dim prp As Variant... did not help
Dim prop As Prope

Set dbs = OpenDatabase("D:\Custord\Menlo2000.mdb")

strTabChar = vbTab
' Set Container object variable.
Set ctr = dbs.Containers(strObjectType)
' Set Document object variable.
Set doc = ctr.Documents(strObjectName)
doc.Properties.Refresh
' Print the object name to Debug window.
Debug.Print doc.Name
' Print each Object property to Debug window.

*********** Type mismatch error is here ************
For Each prp In doc.Properties
******************************************************

Debug.Print strTabChar & prp.Name & " = " & prp.Value
Next
End Sub
 
Debug.Print strTabChar & prp.Name & " = " & CStr(prp.Value)
MichaelRed
mred@att.net

There is never time to do it right but there is always time to do it over
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top