Displaying records from two tables

I have two tables in an Access database (Personnel and Programs).  I need to use a DBCombo box to allow users to select an individuals code.  After the user selects the code from the DBcombo box I need to display data from the two tables.  There will be only one record from the "Personnel" table but multiple records from the "Program" table.  I also need to be able to delete individual records from the "Program" table without affecting the Personnel table.

Any code available will help

clarwcAsked:
Who is Participating?
 
DalinConnect With a Mentor Commented:
clarwc,
The answer is yes.  You can utilize your code interms of dealing with the data (recordset)
The suggestion I provide basically populate the recordset for two data controls.
If you would like my opinion on where to add, I would need a little more information about what you are doing with the data and what kind of code you already have.. You can e-mail me:Dalin_N@MailExcite.Com

By the way, you don't have to reject the answer if you like what the expert provide you so far and just like to work with him a little more.

Regards
Dalin
0
 
fguerreiro_inixCommented:
Use two datacontrols, one for each table. The data controls
will have a where clause to identifie the person in cause.

Regards
0
 
clarwcAuthor Commented:
I am already using two data controls one for each table.  Each table already has a common field (Code).  I need the user to select the appropriate entry from the Code DBCombo and then have the screen update to reflect the single record from the personnel  Table and the multiple records from the Program table.

Thanks
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

 
fguerreiro_inixCommented:
So, what's your problem?
0
 
clarwcAuthor Commented:
When I select the code from the DBcombo nothing happens except changing data already displayed in the first record.  My application isn't taking the information from the DBCombo and displaying the records associated with the selection.

Thanks for your time.
0
 
fguerreiro_inixCommented:
So, what's your problem?
0
 
clarwcAuthor Commented:
Did you see my last?  I am not able to display the records associated with the selection.
0
 
DalinCommented:
clarwe,
Sound like you are new in dealing with this, so I am going to recommend a easy way.

I assume that your two tables has a comman field (say fieldCom) and you have established a one to many relationships between them (Personnel on the one side)

1. Drop a data control, name data1, set the databasename to your database, and recordsource to Personnel.

2. Drop a DBcombo box, name dbCombo1 set rowsource to data1, and listField to fieldCom

3. Drop a number of text boxes (equall to the number of fields in Personnel, set dataSource to data1, and  dataField to a field in the table

4. Drop a 2nd dataControl, name data2, set the dataBaseName to yur database  and datasource to Select * from Program where FieldCom = dbCombo1.Text

5, Drop a dbGrid, bound it to Data2.

6. In the dbCombo1's change event, add:
    data1.FindFirst fieldCommon = dbcombo1.Text
    data2.Refresh.

Try this. If you have hany questions or problems, let me know
Regards
Dalin
 
0
 
DalinCommented:
clarwc,
Strainge. When I first answer the question, none of you two's comments was show. After I submit, I saw the two comments:
from fg: "So What is your problem"
from you: " Did you see my last?"
Now I am seem the ones before that.

That is why my answer used some names not reflecting yours (like fields code)
Anyway, let me know you have any q.
0
 
clarwcAuthor Commented:
Dalin...

Looks like this might be exactly what I need except I don't have a Data2 property called datasource.  I have record source but the SQL string doesn't work there.

Thanks
0
 
DalinCommented:
clarwe,
Sorry for the mistake. I meant Recordsource.
Try to use the following SQL:

Select * from Program where FieldCom =
    'dbCombo1.Text';

Appologize for any inconvinience it may have caused.
Regards.
0
 
clarwcAuthor Commented:
Dalin,

I already have a significant amout of code written that is dependant on recordsourse being set to programs.  Is it possible to add the required statements in code somewhere?  It would sure make things a lot easier.

Thanks so much for your help.

Warren
0
 
clarwcAuthor Commented:
Thanks very Much for your help.

Warren
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.