PC Review
Forums
Newsgroups
Microsoft Access
Microsoft Access VBA Modules
Accessing tables via VBA
Forums
Newsgroups
Microsoft Access
Microsoft Access VBA Modules
Accessing tables via VBA
![]() |
Accessing tables via VBA |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
Hi,
You need to set a reference to the DAO library. From the VB editor go to Tools->References and check the DAO library. You will then have all the familiar objects you are used to. -- HTH Dan Artuso, Access MVP "Kendrick" <mtelbert@amigo.net> wrote in message news:03f801c33f61$5ef380e0$a501280a@phx.gbl... > I am attempting to upgrade a access database from 1997 to > 2002. In Access 1997 I used a series of steps to be able > to view data and edit data in a table from within a > module. I would create a database object set it to > CurrentDb and then use the openrecordset method to set a > recordset variable to the table I wanted to work with. So > far I cannot figure out what a comparable method is in > Access 2002. The database object doesn't even exist > anymore. I hope someone can make sense of this and give > me a few pointers as to how to work with tables from VBA. > > Thanks |
|
|
|
#2 |
|
Guest
Posts: n/a
|
I am attempting to upgrade a access database from 1997 to
2002. In Access 1997 I used a series of steps to be able to view data and edit data in a table from within a module. I would create a database object set it to CurrentDb and then use the openrecordset method to set a recordset variable to the table I wanted to work with. So far I cannot figure out what a comparable method is in Access 2002. The database object doesn't even exist anymore. I hope someone can make sense of this and give me a few pointers as to how to work with tables from VBA. Thanks |
|
|
|
#3 |
|
Guest
Posts: n/a
|
Hi, Thanks for the information about the DAO Library. I found that and clicked on it so that I now have the database object. However, my openrecordset method still isn't working. As far as I can tell I am using the same syntax as exists in the examples I have seen but I still get a run-time error "type mismatch" and when I click debug the line with the openrecordset is highlighted. I have tried a couple of different ways of but still get an error. Method1: using the table name directly Dim db as Database Dim Actions as Recordset Set db = CurrentDb Set Actions = db.OpenRecordset("tblActions") Method2: using SQL to open the table Dim db as Database Dim Actions as Recordset Set db = CurrentDb Set Actions = db.OpenRecordset("SELECT * FROM _ tblActions") Neither of these methods is working, can anyone tell me why I am getting a type-mismatch error and/or how I might fix this problem Thanks >-----Original Message----- >Hi, >You need to set a reference to the DAO library. >From the VB editor go to Tools->References >and check the DAO library. >You will then have all the familiar objects you are >used to. > >-- >HTH >Dan Artuso, Access MVP > > >"Kendrick" <mtelbert@amigo.net> wrote in message >news:03f801c33f61$5ef380e0$a501280a@phx.gbl... >> I am attempting to upgrade a access database from 1997 to >> 2002. In Access 1997 I used a series of steps to be able >> to view data and edit data in a table from within a >> module. I would create a database object set it to >> CurrentDb and then use the openrecordset method to set a >> recordset variable to the table I wanted to work with. So >> far I cannot figure out what a comparable method is in >> Access 2002. The database object doesn't even exist >> anymore. I hope someone can make sense of this and give >> me a few pointers as to how to work with tables from VBA. >> >> Thanks > > >. > |
|
|
|
#4 |
|
Guest
Posts: n/a
|
Kendrick previously wrote:
> > Method1: using the table name directly > Dim db as Database > Dim Actions as Recordset Dim Actions as dao.recordset Regards Peter Russell |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

