VB says type mismatch and method not found 
Author Message
 VB says type mismatch and method not found

Hi,

I admit I'm new to VB, so my problem might be easy to
solve. I want to write a program to update a table with
specific records from another table. My problem are
some "type-mismatch" errors, that I cannot understand
and "didn't find methods". I wrote this procedure in the
VBA-Editor in Access (Version: Ofiice XP)

Progam:
Sub Update()
    Dim Original, Imported As Object
    Dim Outlook As Object
    Dim Datensatz_Orig As Recordset
    Dim help, intI As Integer
    Set Outlook = DBEngine.Workspaces(0).OpenDatabase _
("Outlook.mdb")
    Set Original = Outlook.TableDefs _
("Contacts") 'Application.CurrentData.AllTables.Item _
("Contacts_Import")
    Set Imported = Outlook.TableDefs("Contacts_Import")
    intI = Original.TableDefs.RecordSets.Count
    Debug.Print "Anzahl der Datens?tze ist " & intI
    For help = 0 To intI
        Set Datensatz_Orig = _
Original.TableDefs.RecordSets.Recordset(intI)
        Debug.Print Datensatz_Orig.DataSource
    Next help

End Sub

I put in some " _" because of the line-breaks in the
forum. The runtime-error occurs the line saying:
intI = Original.TableDefs.RecordSets.Count

It says "Object doesn't suppor this property or method."

Why? I looked this property up in the help, it's a
property of recordsets.
Another type of error ocurred at several points, saying
type-mismatch. E.g. in this line:
Set Datensatz_Orig = _
Original.TableDefs.RecordSets.Recordset(intI)

It says type-mismatch although RecordSet(intI) should
specify a type of recordset.
It also said type-mismatch earlier when I used as a
declaration in the first line:
Dim Original,Imported As Table

In an other program I had the same error with the object
property. I just copied sample-code from the help. It
doesn't work! I had to use the most general
type: "Object" Even "AccessObject" didn't work.

Can anybody help me? That would be very nice.
Greetings,
Matthaeus



Wed, 14 Dec 2005 23:54:47 GMT  
 VB says type mismatch and method not found
A DAO TableDefs object is a collection (of TableDef objects).  It does NOT
have a Recordsets property (or method for that matter).

Is there a particular reason for using DAO instead of ADO?  If this is a
"learning" project, you'd be better off learning ADO.

HTH,
Tore.


Hi,

I admit I'm new to VB, so my problem might be easy to
solve. I want to write a program to update a table with
specific records from another table. My problem are
some "type-mismatch" errors, that I cannot understand
and "didn't find methods". I wrote this procedure in the
VBA-Editor in Access (Version: Ofiice XP)

Progam:
Sub Update()
    Dim Original, Imported As Object
    Dim Outlook As Object
    Dim Datensatz_Orig As Recordset
    Dim help, intI As Integer
    Set Outlook = DBEngine.Workspaces(0).OpenDatabase _
("Outlook.mdb")
    Set Original = Outlook.TableDefs _
("Contacts") 'Application.CurrentData.AllTables.Item _
("Contacts_Import")
    Set Imported = Outlook.TableDefs("Contacts_Import")
    intI = Original.TableDefs.RecordSets.Count
    Debug.Print "Anzahl der Datens?tze ist " & intI
    For help = 0 To intI
        Set Datensatz_Orig = _
Original.TableDefs.RecordSets.Recordset(intI)
        Debug.Print Datensatz_Orig.DataSource
    Next help

End Sub

I put in some " _" because of the line-breaks in the
forum. The runtime-error occurs the line saying:
intI = Original.TableDefs.RecordSets.Count

It says "Object doesn't suppor this property or method."

Why? I looked this property up in the help, it's a
property of recordsets.
Another type of error ocurred at several points, saying
type-mismatch. E.g. in this line:
Set Datensatz_Orig = _
Original.TableDefs.RecordSets.Recordset(intI)

It says type-mismatch although RecordSet(intI) should
specify a type of recordset.
It also said type-mismatch earlier when I used as a
declaration in the first line:
Dim Original,Imported As Table

In an other program I had the same error with the object
property. I just copied sample-code from the help. It
doesn't work! I had to use the most general
type: "Object" Even "AccessObject" didn't work.

Can anybody help me? That would be very nice.
Greetings,
Matthaeus



Thu, 15 Dec 2005 02:08:41 GMT  
 VB says type mismatch and method not found
Thanks for your answer. I corrected it and it works now!
Thanks.
There is just one more thing that I don't understand.

I cannot assign an appropriate object to variables that
are declared as "Table" or "Recordset" or "AccessObject"

It works now for me if I declare the variables
as "Object". But why doesn't it work with the specific
variables?

And one more (stupid) question. What is the difference
between ADO and DAO? I'm still a little lost in the
forest. I was happy at all just to find methods to work
with tables.

Thanks and have a nice day,
Matthaeus

Quote:
>-----Original Message-----
>A DAO TableDefs object is a collection (of TableDef

objects).  It does NOT
Quote:
>have a Recordsets property (or method for that matter).

>Is there a particular reason for using DAO instead of
ADO?  If this is a
>"learning" project, you'd be better off learning ADO.

>HTH,
>Tore.




>Hi,

>I admit I'm new to VB, so my problem might be easy to
>solve. I want to write a program to update a table with
>specific records from another table. My problem are
>some "type-mismatch" errors, that I cannot understand
>and "didn't find methods". I wrote this procedure in the
>VBA-Editor in Access (Version: Ofiice XP)

>Progam:
>Sub Update()
>    Dim Original, Imported As Object
>    Dim Outlook As Object
>    Dim Datensatz_Orig As Recordset
>    Dim help, intI As Integer
>    Set Outlook = DBEngine.Workspaces(0).OpenDatabase _
>("Outlook.mdb")
>    Set Original = Outlook.TableDefs _
>("Contacts") 'Application.CurrentData.AllTables.Item _
>("Contacts_Import")
>    Set Imported = Outlook.TableDefs("Contacts_Import")
>    intI = Original.TableDefs.RecordSets.Count
>    Debug.Print "Anzahl der Datens?tze ist " & intI
>    For help = 0 To intI
>        Set Datensatz_Orig = _
>Original.TableDefs.RecordSets.Recordset(intI)
>        Debug.Print Datensatz_Orig.DataSource
>    Next help

>End Sub

>I put in some " _" because of the line-breaks in the
>forum. The runtime-error occurs the line saying:
>intI = Original.TableDefs.RecordSets.Count

>It says "Object doesn't suppor this property or method."

>Why? I looked this property up in the help, it's a
>property of recordsets.
>Another type of error ocurred at several points, saying
>type-mismatch. E.g. in this line:
>Set Datensatz_Orig = _
>Original.TableDefs.RecordSets.Recordset(intI)

>It says type-mismatch although RecordSet(intI) should
>specify a type of recordset.
>It also said type-mismatch earlier when I used as a
>declaration in the first line:
>Dim Original,Imported As Table

>In an other program I had the same error with the object
>property. I just copied sample-code from the help. It
>doesn't work! I had to use the most general
>type: "Object" Even "AccessObject" didn't work.

>Can anybody help me? That would be very nice.
>Greetings,
>Matthaeus

>.



Thu, 15 Dec 2005 02:46:43 GMT  
 VB says type mismatch and method not found
You are probably trying to use the wrong object type.

Also, the line:

    Dim Original, Imported As Object

contains a non-obvious trap.  It is equivalent with the following:

    Dim Original
    Dim Imported As Object

The type specification ONLY applies to the variable it follows!  Therefore,
it is often considered best practice to declare each variable on a separate
line.

Be aware that when you assign a reference to an item in the collection, the
object should be typed the same as those objects that the collection holds.
In your case

    Set Imported = Outlook.TableDefs("Contacts_Import")

you are referencing an item ("Contacts_Import") in the TableDefs collection.
The TableDefs collection is a collection of TableDef objects, so the
declaration

    Dim Imported as TableDef

would be appropriate for this particular code line.

This should get you a step further... :->

HTH,
Tore.


Thanks for your answer. I corrected it and it works now!
Thanks.
There is just one more thing that I don't understand.

I cannot assign an appropriate object to variables that
are declared as "Table" or "Recordset" or "AccessObject"

It works now for me if I declare the variables
as "Object". But why doesn't it work with the specific
variables?

And one more (stupid) question. What is the difference
between ADO and DAO? I'm still a little lost in the
forest. I was happy at all just to find methods to work
with tables.

Thanks and have a nice day,
Matthaeus

Quote:
>-----Original Message-----
>A DAO TableDefs object is a collection (of TableDef

objects).  It does NOT
Quote:
>have a Recordsets property (or method for that matter).

>Is there a particular reason for using DAO instead of
ADO?  If this is a
>"learning" project, you'd be better off learning ADO.

>HTH,
>Tore.




>Hi,

>I admit I'm new to VB, so my problem might be easy to
>solve. I want to write a program to update a table with
>specific records from another table. My problem are
>some "type-mismatch" errors, that I cannot understand
>and "didn't find methods". I wrote this procedure in the
>VBA-Editor in Access (Version: Ofiice XP)

>Progam:
>Sub Update()
>    Dim Original, Imported As Object
>    Dim Outlook As Object
>    Dim Datensatz_Orig As Recordset
>    Dim help, intI As Integer
>    Set Outlook = DBEngine.Workspaces(0).OpenDatabase _
>("Outlook.mdb")
>    Set Original = Outlook.TableDefs _
>("Contacts") 'Application.CurrentData.AllTables.Item _
>("Contacts_Import")
>    Set Imported = Outlook.TableDefs("Contacts_Import")
>    intI = Original.TableDefs.RecordSets.Count
>    Debug.Print "Anzahl der Datens?tze ist " & intI
>    For help = 0 To intI
>        Set Datensatz_Orig = _
>Original.TableDefs.RecordSets.Recordset(intI)
>        Debug.Print Datensatz_Orig.DataSource
>    Next help

>End Sub

>I put in some " _" because of the line-breaks in the
>forum. The runtime-error occurs the line saying:
>intI = Original.TableDefs.RecordSets.Count

>It says "Object doesn't suppor this property or method."

>Why? I looked this property up in the help, it's a
>property of recordsets.
>Another type of error ocurred at several points, saying
>type-mismatch. E.g. in this line:
>Set Datensatz_Orig = _
>Original.TableDefs.RecordSets.Recordset(intI)

>It says type-mismatch although RecordSet(intI) should
>specify a type of recordset.
>It also said type-mismatch earlier when I used as a
>declaration in the first line:
>Dim Original,Imported As Table

>In an other program I had the same error with the object
>property. I just copied sample-code from the help. It
>doesn't work! I had to use the most general
>type: "Object" Even "AccessObject" didn't work.

>Can anybody help me? That would be very nice.
>Greetings,
>Matthaeus

>.



Thu, 15 Dec 2005 03:16:46 GMT  
 VB says type mismatch and method not found
Hi,

these issues work now. I corrected this
->    Dim Original As TableDef
->    Dim Imported As TableDef

which doesn't produce errors anymore. But in an other
line I get an error.
As I understand it, recordset is an object of database.
So now I used the code

Set Datensatz_Orig = Outlook.OpenRecordset("Contacts")

which yields the desired results. But it only works if
Datensatz_Orig is declared as Object and not as Recordset
(nor as TableDef). The same is true for a new variable
Felder for getting the fields of that recordset. It
cannot be declared as Field, only as Object.

If I declare these two variables as Object everything
works. Just curious why it doesn't the other way.

Thanks for your replies,
Matthaeus

Quote:
>-----Original Message-----
>You are probably trying to use the wrong object type.

>Also, the line:

>    Dim Original, Imported As Object

>contains a non-obvious trap.  It is equivalent with the
following:

>    Dim Original
>    Dim Imported As Object

>The type specification ONLY applies to the variable it

follows!  Therefore,
Quote:
>it is often considered best practice to declare each

variable on a separate
Quote:
>line.

>Be aware that when you assign a reference to an item in
the collection, the
>object should be typed the same as those objects that

the collection holds.
Quote:
>In your case

>    Set Imported = Outlook.TableDefs("Contacts_Import")

>you are referencing an item ("Contacts_Import") in the

TableDefs collection.
Quote:
>The TableDefs collection is a collection of TableDef
objects, so the
>declaration

>    Dim Imported as TableDef

>would be appropriate for this particular code line.

>This should get you a step further... :->

>HTH,
>Tore.


message

>Thanks for your answer. I corrected it and it works now!
>Thanks.
>There is just one more thing that I don't understand.

>I cannot assign an appropriate object to variables that
>are declared as "Table" or "Recordset" or "AccessObject"

>It works now for me if I declare the variables
>as "Object". But why doesn't it work with the specific
>variables?

>And one more (stupid) question. What is the difference
>between ADO and DAO? I'm still a little lost in the
>forest. I was happy at all just to find methods to work
>with tables.

>Thanks and have a nice day,
>Matthaeus
>>-----Original Message-----
>>A DAO TableDefs object is a collection (of TableDef
>objects).  It does NOT
>>have a Recordsets property (or method for that matter).

>>Is there a particular reason for using DAO instead of
>ADO?  If this is a
>>"learning" project, you'd be better off learning ADO.

>>HTH,
>>Tore.




>>Hi,

>>I admit I'm new to VB, so my problem might be easy to
>>solve. I want to write a program to update a table with
>>specific records from another table. My problem are
>>some "type-mismatch" errors, that I cannot understand
>>and "didn't find methods". I wrote this procedure in the
>>VBA-Editor in Access (Version: Ofiice XP)

>>Progam:
>>Sub Update()
>>    Dim Original, Imported As Object
>>    Dim Outlook As Object
>>    Dim Datensatz_Orig As Recordset
>>    Dim help, intI As Integer
>>    Set Outlook = DBEngine.Workspaces(0).OpenDatabase _
>>("Outlook.mdb")
>>    Set Original = Outlook.TableDefs _
>>("Contacts") 'Application.CurrentData.AllTables.Item _
>>("Contacts_Import")
>>    Set Imported = Outlook.TableDefs("Contacts_Import")
>>    intI = Original.TableDefs.RecordSets.Count
>>    Debug.Print "Anzahl der Datens?tze ist " & intI
>>    For help = 0 To intI
>>        Set Datensatz_Orig = _
>>Original.TableDefs.RecordSets.Recordset(intI)
>>        Debug.Print Datensatz_Orig.DataSource
>>    Next help

>>End Sub

>>I put in some " _" because of the line-breaks in the
>>forum. The runtime-error occurs the line saying:
>>intI = Original.TableDefs.RecordSets.Count

>>It says "Object doesn't suppor this property or method."

>>Why? I looked this property up in the help, it's a
>>property of recordsets.
>>Another type of error ocurred at several points, saying
>>type-mismatch. E.g. in this line:
>>Set Datensatz_Orig = _
>>Original.TableDefs.RecordSets.Recordset(intI)

>>It says type-mismatch although RecordSet(intI) should
>>specify a type of recordset.
>>It also said type-mismatch earlier when I used as a
>>declaration in the first line:
>>Dim Original,Imported As Table

>>In an other program I had the same error with the object
>>property. I just copied sample-code from the help. It
>>doesn't work! I had to use the most general
>>type: "Object" Even "AccessObject" didn't work.

>>Can anybody help me? That would be very nice.
>>Greetings,
>>Matthaeus

>>.

>.



Thu, 15 Dec 2005 03:41:55 GMT  
 VB says type mismatch and method not found

Quote:
> Hi,

> these issues work now. I corrected this
> ->    Dim Original As TableDef
> ->    Dim Imported As TableDef

> which doesn't produce errors anymore. But in an other
> line I get an error.
> As I understand it, recordset is an object of database.
> So now I used the code

> Set Datensatz_Orig = Outlook.OpenRecordset("Contacts")

> which yields the desired results. But it only works if
> Datensatz_Orig is declared as Object and not as Recordset
> (nor as TableDef). The same is true for a new variable
> Felder for getting the fields of that recordset. It
> cannot be declared as Field, only as Object.

If your project has references to both DAO and ADO then you have
DAO.Recordset objects and ADODB.Recordset objects and when you refer to
something only as a 'Recordset' VB has to decide which you mean.  It does
this by looking at which is listed first in the Project / References list
and you can go there and use the up/down arrows to change the order.  A
better solution is to be more specific when you declare the objects:

Dim Outlook As DAO.Database
Dim Datensatz_Orig As DAO.Recordset
<etc>



Thu, 15 Dec 2005 06:11:08 GMT  
 VB says type mismatch and method not found
I has been a while since I used DAO, so I don't quite recall how it handles
the fact that it creates different "types" of recordset objects (snapshots,
dynasets, table objects).  Since you specify (I presume) a table name in
.OpenRecordset, and you leave the other parameters as default - if the table
is not linked, AFAIK DAO will open a table type recordset.  Leave the
declaration as Object, put a breakpoint after creating the recordset, and
type ?TypeName(Datensatz_Orig) in the immediate window.  That will tell you
the correct object type to use in the declaration.

When you get a type mismatch on an object reference assignment (assuming the
right hand side of the assignment is OK) is *ALWAYS* because you have
defined the wrong type for the target object variable.

I would really recommend that you try doing this in ADO instead.  While DAO
is still good for a handful of special things with an MS Access database, it
is really an "obsolete" technology.  Use ADO unless there is a specific
capability required that DAO has and ADO (plus ADOX) doesn't have, or you
are supporting a legacy application written with DAO.  ADO is really the
recommended database access method in "classic" VB.  VB.Net introduces
ADO.Net, and even though it is somewhat different from ADO, it isn't
radically different.  But DAO will leave you unprepared for real database
work - as well as the jump to DotNet.

HTH,
Tore.


Hi,

these issues work now. I corrected this
->    Dim Original As TableDef
->    Dim Imported As TableDef

which doesn't produce errors anymore. But in an other
line I get an error.
As I understand it, recordset is an object of database.
So now I used the code

Set Datensatz_Orig = Outlook.OpenRecordset("Contacts")

which yields the desired results. But it only works if
Datensatz_Orig is declared as Object and not as Recordset
(nor as TableDef). The same is true for a new variable
Felder for getting the fields of that recordset. It
cannot be declared as Field, only as Object.

If I declare these two variables as Object everything
works. Just curious why it doesn't the other way.

Thanks for your replies,
Matthaeus

Quote:
>-----Original Message-----
>You are probably trying to use the wrong object type.

>Also, the line:

>    Dim Original, Imported As Object

>contains a non-obvious trap.  It is equivalent with the
following:

>    Dim Original
>    Dim Imported As Object

>The type specification ONLY applies to the variable it

follows!  Therefore,
Quote:
>it is often considered best practice to declare each

variable on a separate
Quote:
>line.

>Be aware that when you assign a reference to an item in
the collection, the
>object should be typed the same as those objects that

the collection holds.
Quote:
>In your case

>    Set Imported = Outlook.TableDefs("Contacts_Import")

>you are referencing an item ("Contacts_Import") in the

TableDefs collection.
Quote:
>The TableDefs collection is a collection of TableDef
objects, so the
>declaration

>    Dim Imported as TableDef

>would be appropriate for this particular code line.

>This should get you a step further... :->

>HTH,
>Tore.


message

>Thanks for your answer. I corrected it and it works now!
>Thanks.
>There is just one more thing that I don't understand.

>I cannot assign an appropriate object to variables that
>are declared as "Table" or "Recordset" or "AccessObject"

>It works now for me if I declare the variables
>as "Object". But why doesn't it work with the specific
>variables?

>And one more (stupid) question. What is the difference
>between ADO and DAO? I'm still a little lost in the
>forest. I was happy at all just to find methods to work
>with tables.

>Thanks and have a nice day,
>Matthaeus
>>-----Original Message-----
>>A DAO TableDefs object is a collection (of TableDef
>objects).  It does NOT
>>have a Recordsets property (or method for that matter).

>>Is there a particular reason for using DAO instead of
>ADO?  If this is a
>>"learning" project, you'd be better off learning ADO.

>>HTH,
>>Tore.




>>Hi,

>>I admit I'm new to VB, so my problem might be easy to
>>solve. I want to write a program to update a table with
>>specific records from another table. My problem are
>>some "type-mismatch" errors, that I cannot understand
>>and "didn't find methods". I wrote this procedure in the
>>VBA-Editor in Access (Version: Ofiice XP)

>>Progam:
>>Sub Update()
>>    Dim Original, Imported As Object
>>    Dim Outlook As Object
>>    Dim Datensatz_Orig As Recordset
>>    Dim help, intI As Integer
>>    Set Outlook = DBEngine.Workspaces(0).OpenDatabase _
>>("Outlook.mdb")
>>    Set Original = Outlook.TableDefs _
>>("Contacts") 'Application.CurrentData.AllTables.Item _
>>("Contacts_Import")
>>    Set Imported = Outlook.TableDefs("Contacts_Import")
>>    intI = Original.TableDefs.RecordSets.Count
>>    Debug.Print "Anzahl der Datens?tze ist " & intI
>>    For help = 0 To intI
>>        Set Datensatz_Orig = _
>>Original.TableDefs.RecordSets.Recordset(intI)
>>        Debug.Print Datensatz_Orig.DataSource
>>    Next help

>>End Sub

>>I put in some " _" because of the line-breaks in the
>>forum. The runtime-error occurs the line saying:
>>intI = Original.TableDefs.RecordSets.Count

>>It says "Object doesn't suppor this property or method."

>>Why? I looked this property up in the help, it's a
>>property of recordsets.
>>Another type of error ocurred at several points, saying
>>type-mismatch. E.g. in this line:
>>Set Datensatz_Orig = _
>>Original.TableDefs.RecordSets.Recordset(intI)

>>It says type-mismatch although RecordSet(intI) should
>>specify a type of recordset.
>>It also said type-mismatch earlier when I used as a
>>declaration in the first line:
>>Dim Original,Imported As Table

>>In an other program I had the same error with the object
>>property. I just copied sample-code from the help. It
>>doesn't work! I had to use the most general
>>type: "Object" Even "AccessObject" didn't work.

>>Can anybody help me? That would be very nice.
>>Greetings,
>>Matthaeus

>>.

>.



Thu, 15 Dec 2005 09:27:28 GMT  
 VB says type mismatch and method not found
Now I found the error. In the references two libraries
have to be unchecked. In addition to the ADO Ext 2.7 one
there also has to be removed:

Microsoft ActiveX Data Objects Library 2.1

(which is the plain ADO-library, the other one is ADOX,
is assume).

I noticed that there are some newer versions too and now,
as I found a good document to learn how to handle ADO, I
switched it to version 2.7 which hopefully doesn't cause
problems.

Thanks for your help,
Matthaeus

Quote:
>-----Original Message-----
>Hi,

>these issues work now. I corrected this
>->    Dim Original As TableDef
>->    Dim Imported As TableDef

>which doesn't produce errors anymore. But in an other
>line I get an error.
>As I understand it, recordset is an object of database.
>So now I used the code

>Set Datensatz_Orig = Outlook.OpenRecordset("Contacts")

>which yields the desired results. But it only works if
>Datensatz_Orig is declared as Object and not as
Recordset
>(nor as TableDef). The same is true for a new variable
>Felder for getting the fields of that recordset. It
>cannot be declared as Field, only as Object.

>If I declare these two variables as Object everything
>works. Just curious why it doesn't the other way.

>Thanks for your replies,
>Matthaeus

>>-----Original Message-----
>>You are probably trying to use the wrong object type.

>>Also, the line:

>>    Dim Original, Imported As Object

>>contains a non-obvious trap.  It is equivalent with the
>following:

>>    Dim Original
>>    Dim Imported As Object

>>The type specification ONLY applies to the variable it
>follows!  Therefore,
>>it is often considered best practice to declare each
>variable on a separate
>>line.

>>Be aware that when you assign a reference to an item in
>the collection, the
>>object should be typed the same as those objects that
>the collection holds.
>>In your case

>>    Set Imported = Outlook.TableDefs("Contacts_Import")

>>you are referencing an item ("Contacts_Import") in the
>TableDefs collection.
>>The TableDefs collection is a collection of TableDef
>objects, so the
>>declaration

>>    Dim Imported as TableDef

>>would be appropriate for this particular code line.

>>This should get you a step further... :->

>>HTH,
>>Tore.


>message

>>Thanks for your answer. I corrected it and it works now!
>>Thanks.
>>There is just one more thing that I don't understand.

>>I cannot assign an appropriate object to variables that
>>are declared as "Table" or "Recordset" or "AccessObject"

>>It works now for me if I declare the variables
>>as "Object". But why doesn't it work with the specific
>>variables?

>>And one more (stupid) question. What is the difference
>>between ADO and DAO? I'm still a little lost in the
>>forest. I was happy at all just to find methods to work
>>with tables.

>>Thanks and have a nice day,
>>Matthaeus
>>>-----Original Message-----
>>>A DAO TableDefs object is a collection (of TableDef
>>objects).  It does NOT
>>>have a Recordsets property (or method for that matter).

>>>Is there a particular reason for using DAO instead of
>>ADO?  If this is a
>>>"learning" project, you'd be better off learning ADO.

>>>HTH,
>>>Tore.




>>>Hi,

>>>I admit I'm new to VB, so my problem might be easy to
>>>solve. I want to write a program to update a table with
>>>specific records from another table. My problem are
>>>some "type-mismatch" errors, that I cannot understand
>>>and "didn't find methods". I wrote this procedure in
the
>>>VBA-Editor in Access (Version: Ofiice XP)

>>>Progam:
>>>Sub Update()
>>>    Dim Original, Imported As Object
>>>    Dim Outlook As Object
>>>    Dim Datensatz_Orig As Recordset
>>>    Dim help, intI As Integer
>>>    Set Outlook = DBEngine.Workspaces(0).OpenDatabase _
>>>("Outlook.mdb")
>>>    Set Original = Outlook.TableDefs _
>>>("Contacts") 'Application.CurrentData.AllTables.Item _
>>>("Contacts_Import")
>>>    Set Imported = Outlook.TableDefs("Contacts_Import")
>>>    intI = Original.TableDefs.RecordSets.Count
>>>    Debug.Print "Anzahl der Datens?tze ist " & intI
>>>    For help = 0 To intI
>>>        Set Datensatz_Orig = _
>>>Original.TableDefs.RecordSets.Recordset(intI)
>>>        Debug.Print Datensatz_Orig.DataSource
>>>    Next help

>>>End Sub

>>>I put in some " _" because of the line-breaks in the
>>>forum. The runtime-error occurs the line saying:
>>>intI = Original.TableDefs.RecordSets.Count

>>>It says "Object doesn't suppor this property or
method."

>>>Why? I looked this property up in the help, it's a
>>>property of recordsets.
>>>Another type of error ocurred at several points, saying
>>>type-mismatch. E.g. in this line:
>>>Set Datensatz_Orig = _
>>>Original.TableDefs.RecordSets.Recordset(intI)

>>>It says type-mismatch although RecordSet(intI) should
>>>specify a type of recordset.
>>>It also said type-mismatch earlier when I used as a
>>>declaration in the first line:
>>>Dim Original,Imported As Table

>>>In an other program I had the same error with the
object
>>>property. I just copied sample-code from the help. It
>>>doesn't work! I had to use the most general
>>>type: "Object" Even "AccessObject" didn't work.

>>>Can anybody help me? That would be very nice.
>>>Greetings,
>>>Matthaeus

>>>.

>>.

>.



Thu, 15 Dec 2005 18:43:20 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. type-mismatch and method not found (beginner)

2. Type Mismatch error on an OpenRecordset method

3. Type Mismatch (13) with OpenText Method FieldInfo argument

4. VB5 Calling ActiveX method - Type Mismatch error

5. VB5 Calling ActiveX method - Type Mismatch error

6. Type mismatch when calling COM methods

7. Type mismatch error when using show method on MDI Child with borderstyle=4 (fixed toolwindow)

8. Error 429: VB5 says license info not found for common dialog control

9. It say UDT can not be found when I compile my project

10. RecordSet Find - Type Mismatch

11. Prob. w\ TYPE data type: err:Type Mismatch

12. Type Mismatch Error in 2000, not in 97

 

 
Powered by phpBB® Forum Software