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!

dbOpenDynaset wont allow Addnew method 2

Status
Not open for further replies.

Frank72

Technical User
Nov 13, 2001
57
IE
hows it going

further to the thread i last posted answered by mossoft(thanks), i tried using the opendynaset before and opentable(if it is a jet workspace) but opentable is not allowed as the recordset object and the dynaset object is returning an err saying the addnew method is not allowed, does this look like a syntax thing or something else that might be affecting the recordest? i know dynaset is supposed to support addnew so what's the problem? here's the code

Dim DefaultDate As Date
Dim Dbase As Database
Dim RstLog, RstCtl, Rst3 As Recordset

Set Dbase = DBEngine.Workspaces(0).Databases(0)
Set RstCtl = Dbase.OpenRecordset("KHPRDDTA_TBLXFERCTL", dbOpenSnapshot)
Set RstLog = Dbase.OpenRecordset("KHPRDDTA_TBLXFERLOG", dbOpenDynamic)
Set Rst3 = Dbase.OpenRecordset("khprddta_tblvehicle", dbOpenSnapshot)

*
*
*
with rstlog
.addnew **err msg here**
.etc etc
thanks alot

frank
 
I think it's becase rstLog isn't a recordset - it's a variant. You need to declare your variables like this:

Dim DefaultDate As Date
Dim Dbase As Database
Dim RstLog As Recordset, RstCtl As Recordset, Rst3 As Recordset

Otherwise both RstLog and RstCtl will both be variant variables.

HTH.

Ed Metcalfe
ed_metcalfe@hotmail.com
 
Also use:

Set Dbase = CurrentDB

Rather than:

Set Dbase = DBEngine.Workspaces(0).Databases(0)

Better practice. :eek:)

Ed Metcalfe
ed_metcalfe@hotmail.com
 
Spotted a mistake in my advice:

Dim DefaultDate As Date
Dim Dbase As DAO.Database
Dim RstLog As DAO.Recordset, RstCtl As DAO.Recordset, Rst3 As DAO.Recordset
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top