Recordset Question

mathisjay

Registered User.
Local time
Today, 10:26
Joined
Apr 7, 2004
Messages
14
I feel like this is a stupid question but I can't figure out how to do it easily.

I have a database structure that has 4 parent type data objects and then 1 child object (Cells) that is the unique combination of each of the parent objects.

I need a way to ensure that whenever a new record is added into one of the parent objects, that all of the new possible Cells are automatically created in the Cells table.

I know how to do this in VB using ADO recordsets, but I'm not sure of the easiest way to do this in Access and I am not familiar with all the Access tricks yet.

I would like to be able to open each parent table directly as a recordset, but it appears I have to set up a Connection object (with a connection string = to the .mdb I am currenty in?).

Isn't there some way to just directly open up a table as a recordset and then parse through each record without having to set up a connection first. It seems like Access should already know what the connection object is since I am in the database already.

Any help?
 
Last edited:
I like to use DAO in Access and yes, you don't have to setup the connection string.

Dim rst as DAO.Recordset

Set rst = CurrentDb.OpenRecordset("Table or Query Name")
 
Yes, it's quite simple if you're using ADO in Access. Access provides the CurrentProject.Connection property for you. Here's some sample code:
Code:
Dim rst As ADODB.Recordset

    Set rst = New ADODB.Recordset
    rst.Open "TableName", CurrentProject.Connection, , , adCmdTable
    'Do your processing in here
    rst.Close
    Set rst = Nothing
End Sub
 
Awesome. Thank you. I knew it had to to be something simple like that.
 

Users who are viewing this thread

Back
Top Bottom