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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADO and Access problem

Status
Not open for further replies.

mcbigj

Programmer
Dec 14, 2001
83
US
If I am working in an Access file. How can I access a table through a recordset using ado for a table in the same file? I keep getting a permissions problem. I can create the connectionobject and rs object no prob but it won't let me open the database that I am currently in, only another one. Any ideas?
Thanks
 
I have just been having a look at using ADO, & I would be interested in how you have been declaring your connection object. Most of the help documentation suggests opening an external source. however you can open objects within the current database in the following way:


Dim cnn as ADODB.Connection, rst as ADODB.Recordset
set cnn = CurrentProject.Connection
set rst = New ADODB.recordset
rst.open = "SELECT * FROM TABLENAME....", cnn


even though specifying the connection is optional, I have found omitting it led to errors & a failure to connect...


HTH

James Goodman
 
I think my problem was that I left the CurrentProject part out. I am declaring the conn object and rs the same as you. What I actually have ended up doing was "splitting" the db from the tables which creates to .mdb files. According to my QUE book that is recommended when building an Access application. Then I had no trouble connecting and getting the results I wanted. thanks for the help :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top