problem with recordset

M

ma

hello,
I am new in VBA for access and I wrote the following simple code but it
doesn't work properly:

Dim wrkJet As Workspace
Dim db As Database
Dim mytable As Recordset

Set wrkJet = CreateWorkspace("", "admin", "", dbUseJet)
Set db = wrkJet.OpenDatabase("c:\jila_databse.mdb")
Set mytable = db.OpenRecordset("tblEpisodes", dbOpenTable)


the error is that type mismatch and it points to the line that opens
recordset. what is the problem?

Best regards
 
D

Dirk Goldgar

ma said:
hello,
I am new in VBA for access and I wrote the following simple code
but it doesn't work properly:

Dim wrkJet As Workspace
Dim db As Database
Dim mytable As Recordset

Set wrkJet = CreateWorkspace("", "admin", "", dbUseJet)
Set db = wrkJet.OpenDatabase("c:\jila_databse.mdb")
Set mytable = db.OpenRecordset("tblEpisodes", dbOpenTable)


the error is that type mismatch and it points to the line that opens
recordset. what is the problem?

Best regards

See my reply to youir earlier post. In general, you should be prepared
to wait at least a day before reposting the same question. Newsgroups
are not chat rooms.
 
G

Guest

If the code you are writing is in c:\jila_databse.mdb with the tables then
you can write the code as follow

Dim db As Database
Dim mytable As Recordset

Set db = codedb() 'Current DB
Set mytable = db.OpenRecordset("tblEpisodes")

just a note
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Run-time error 3356 2
Opening recordsets in forms 1
Tabledef problem 1
VBA for access 4
Creating New Field Dynamically 1
Run Access query from Excel 2
Limit to 255 columns 2
Help querying a table using VBA 4

Top