Help on a type mismatch error

  • Thread starter Thread starter Eric Piquette
  • Start date Start date
E

Eric Piquette

Hi,

I'm currently converting an Access 2.0 database into the XP format (still
using DAO) and I'm getting a weird type mismatch error during runtime. The
code is under an "add" button :

Dim MaBD As Database
Dim MaTable As Recordset
Set MaBD = DBEngine.Workspaces(0).Databases(0)
---
Set MaTable = MaBD.OpenRecordset ("Protocoles", DB_OPEN_TABLE)
---
MaTable.AddNew
MaTable.Update
MaTable.MoveLast
NoRecord = MaTable![No]
MaTable.Close

The error is given on the OpenRecordSet method. However, the data types
match the proposed syntax, and I have the exact same syntax working under
another database in Access 2000 format. (The project references are
identical). Can anyone help ? I've tried changing the options constant name
to dbOpenTable, and adding a lockedits parameter, but it still doesn't work.

Thanks in advance,

Eric P.
 
Eric,

Try using a Dynaset:

Set MaTable = MaBD.OpenRecordset ("Protocoles", dbOpenDynaset)


hth,
 
Hi,

Thanks for your response ! I tried, but I still get the type mismatch error.
I also tried dbOpenSnapShot, dbForwardOnly and the other options constants,
but it doesn't work None of the lockedits contants seem to work either. Any
other suggestions ?


Thanks again,

Eric P.


Cheryl Fischer said:
Eric,

Try using a Dynaset:

Set MaTable = MaBD.OpenRecordset ("Protocoles", dbOpenDynaset)


hth,
--
Cheryl Fischer
Law/Sys Associates
Houston, TX

Eric Piquette said:
Hi,

I'm currently converting an Access 2.0 database into the XP format (still
using DAO) and I'm getting a weird type mismatch error during runtime. The
code is under an "add" button :

Dim MaBD As Database
Dim MaTable As Recordset
Set MaBD = DBEngine.Workspaces(0).Databases(0)
---
Set MaTable = MaBD.OpenRecordset ("Protocoles", DB_OPEN_TABLE)
---
MaTable.AddNew
MaTable.Update
MaTable.MoveLast
NoRecord = MaTable![No]
MaTable.Close

The error is given on the OpenRecordSet method. However, the data types
match the proposed syntax, and I have the exact same syntax working under
another database in Access 2000 format. (The project references are
identical). Can anyone help ? I've tried changing the options constant name
to dbOpenTable, and adding a lockedits parameter, but it still doesn't work.

Thanks in advance,

Eric P.
 
Hadn't thought of that, it works now.


Thanks for your help !

Eric P.


Brian Camire said:
Have you tried:

Dim MaTable As DAO.Recordset



Eric Piquette said:
Hi,

I'm currently converting an Access 2.0 database into the XP format (still
using DAO) and I'm getting a weird type mismatch error during runtime. The
code is under an "add" button :

Dim MaBD As Database
Dim MaTable As Recordset
Set MaBD = DBEngine.Workspaces(0).Databases(0)
---
Set MaTable = MaBD.OpenRecordset ("Protocoles", DB_OPEN_TABLE)
---
MaTable.AddNew
MaTable.Update
MaTable.MoveLast
NoRecord = MaTable![No]
MaTable.Close

The error is given on the OpenRecordSet method. However, the data types
match the proposed syntax, and I have the exact same syntax working under
another database in Access 2000 format. (The project references are
identical). Can anyone help ? I've tried changing the options constant name
to dbOpenTable, and adding a lockedits parameter, but it still doesn't work.

Thanks in advance,

Eric P.
 
Back
Top