Trouble Opening Recordsets

  • Thread starter Thread starter Chris
  • Start date Start date
C

Chris

Hello,
I am working on a tutorial that will allow a SubRoutine to
open a recordset with the current Database.
It goes as follows


Sub PrintRecords()
Dim dbCurr
Set dbCurr = DBEngine.Workspaces(0).Databases(0)
Dim rsCourses As Recordset

Set rsCourses = dbCurr.OpenRecordset(“Courses”)

End Sub

Every time I run it I get the error that the table does
not exist or is mispelled. Neither is the case I am
confused.

When I run the routine

Sub PrintRecords()
Dim dbCurr
Set dbCurr = DBEngine.Workspaces(0).Databases(0)
Debug.Print dbCurr.Name
End Sub

I get the results
D:\Tutorial\db2.mdb
So I know that it can see the database but not the table.
I have tried all the tables and queries and I keep getting
the same error 3078 message. I am using Access 2000.

Please Help.

Sincerely,

Chris
 
Chris said:
Hello,
I am working on a tutorial that will allow a SubRoutine to
open a recordset with the current Database.
It goes as follows


Sub PrintRecords()
Dim dbCurr
Set dbCurr = DBEngine.Workspaces(0).Databases(0)
Dim rsCourses As Recordset

Set rsCourses = dbCurr.OpenRecordset(“Courses”)

End Sub

Every time I run it I get the error that the table does
not exist or is mispelled. Neither is the case I am
confused.

When I run the routine

Sub PrintRecords()
Dim dbCurr
Set dbCurr = DBEngine.Workspaces(0).Databases(0)
Debug.Print dbCurr.Name
End Sub

I get the results
D:\Tutorial\db2.mdb
So I know that it can see the database but not the table.
I have tried all the tables and queries and I keep getting
the same error 3078 message. I am using Access 2000.

Please Help.

Sincerely,

Chris

I don't see anything wrong with what you've done, except for the
"“" and "”", which may have been introduced by your mail
program. I assume those escape sequences are generated to represent
"curly quotes". But I hope you aren't really using "curly quotes" in
your code. I'm pretty sure *that* wouldn't work. You say you're
working on a tutorial. Did you maybe write your code in Word, and then
copy and paste it into the code module?

Aside from that possibility, I can't see what's wrong. Presumably
you've dealt with the DAO/ADO reference problem, or you'd get a type
mismatch error instead.
 
Hello,
I am working on a tutorial that will allow a SubRoutine to
open a recordset with the current Database.
It goes as follows


Sub PrintRecords()
Dim dbCurr
Set dbCurr = DBEngine.Workspaces(0).Databases(0)
Dim rsCourses As Recordset

Set rsCourses = dbCurr.OpenRecordset(“Courses”)

End Sub

Every time I run it I get the error that the table does
not exist or is mispelled. Neither is the case I am
confused.

When I run the routine

Sub PrintRecords()
Dim dbCurr
Set dbCurr = DBEngine.Workspaces(0).Databases(0)
Debug.Print dbCurr.Name
End Sub

I get the results
D:\Tutorial\db2.mdb
So I know that it can see the database but not the table.
I have tried all the tables and queries and I keep getting
the same error 3078 message. I am using Access 2000.

Please Help.

Sincerely,

Chris


Try Dim dbCurr As Database

Are you sure this is the name of the table or query. It is a very
non-conventional naming convention. also I note you are using a semi
colon. Look up the OpenRecordset method in help it expects a string
for the name fo the record set first, followed by a comma and then how
you want to open that recordset i.e. dbForwardOnly, dbReadOnly,
dbOpenDynaset, dbOpenSnapshot). Have a look at the help file.

It seems to me though, that not only are you using non-standard naming
conventions for your recordset, that Access would not like the use of
hashes, ampersands or semi-colons in a table or query name.

Try renaming the table for the moment and see if you have better
results.

My two cents.

Richard




Its a good job Einstein never had to fill out one of these Government Grant applications or we never would have found out what e equalled. The West Wing
 
Back
Top