Hi,
I have a program that i want to access two different tables in an Access database using ado connections. These tables in the database have a relationship. The first table (setuptab) has just 3 fields right now: setupID (primary key), setupname (name of the setup), and cellid (foreign key to second table). The second table (celltab) has just two fields: cellid (primary key), and cellname (name of the cell associated with the setup in the first table). Is there any way to take the cell id in the first table and bring up the cell name from the second table (celltab). Im putting the information into textboxes on a single form. The code im using for part of this looks like:
Dim adoconnect As Connection
Set adoconnect = New Connection
adoconnect.Open "PROVIDER=Microsoft.jet.OLEDB.4.0;" _
& "Data Source=C:\mydb.mdb;"
Set adoRecordset1 = New Recordset
adoRecordset1.Open "select * from setuptab", _
adoconnect, adOpenStatic, adLockOptimistic
'sname is the name of the textbox to put data into
Set sname.DataSource = adoRecordset1
sname.DataField = "setupname"
'this is where i need to figure out how to reference that second table and use it to populate the second textbox named "cname".
oh, by the way, in the first table (setuptab) the cell id field holds the matching id that is in the second table (celltab). Any suggestions?
thanks
I have a program that i want to access two different tables in an Access database using ado connections. These tables in the database have a relationship. The first table (setuptab) has just 3 fields right now: setupID (primary key), setupname (name of the setup), and cellid (foreign key to second table). The second table (celltab) has just two fields: cellid (primary key), and cellname (name of the cell associated with the setup in the first table). Is there any way to take the cell id in the first table and bring up the cell name from the second table (celltab). Im putting the information into textboxes on a single form. The code im using for part of this looks like:
Dim adoconnect As Connection
Set adoconnect = New Connection
adoconnect.Open "PROVIDER=Microsoft.jet.OLEDB.4.0;" _
& "Data Source=C:\mydb.mdb;"
Set adoRecordset1 = New Recordset
adoRecordset1.Open "select * from setuptab", _
adoconnect, adOpenStatic, adLockOptimistic
'sname is the name of the textbox to put data into
Set sname.DataSource = adoRecordset1
sname.DataField = "setupname"
'this is where i need to figure out how to reference that second table and use it to populate the second textbox named "cname".
oh, by the way, in the first table (setuptab) the cell id field holds the matching id that is in the second table (celltab). Any suggestions?
thanks