Trying to open the current db in Access 2010 through Access Basic

  • Thread starter George C. Derkacs
  • Start date
G

George C. Derkacs

I haven't programmed in Access Basic in quite a long time. Through Access
Basic coding, I use to be able to open the current database and then open a
table and walk through each record. Now I can't even open the database.
Does anybody have an example of how to do the following:
1) Open Workspace
2) Open Current Database (assume name is unknown during run time
3) Open specific table
4) Step through each record and access the fields
 
M

Marshall Barton

George C. Derkacs <George C.
I haven't programmed in Access Basic in quite a long time. Through Access
Basic coding, I use to be able to open the current database and then open a
table and walk through each record. Now I can't even open the database.
Does anybody have an example of how to do the following:
1) Open Workspace
2) Open Current Database (assume name is unknown during run time
3) Open specific table
4) Step through each record and access the fields


Is this the kind of thing you want to do?

Set db = OpenDatabase("full path\mydb.mdb")
Set rs = db.OpenRecordset("table")
Do Until rs.EOF
'do something
rs.MoveNext
Loop
rs.Close : Set rs = Nothing
db.Close : Set db = Nothing

BTW, it's been Visual Basic for Access since Access 95. The
last (only?) Access Basic was in Access 2 and, while that
was a very good version, it's more than long in the tooth
(like me) now ;-)
 

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

Top