Solved

Displaying records from two tables

Posted on 1998-06-08
13
151 Views
Last Modified: 2010-05-03
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

0
Comment
Question by:clarwc
  • 6
  • 4
  • 3
13 Comments
 
LVL 3

Expert Comment

by:fguerreiro_inix
ID: 1462757
Use two datacontrols, one for each table. The data controls
will have a where clause to identifie the person in cause.

Regards
0
 

Author Comment

by:clarwc
ID: 1462758
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
 
LVL 3

Expert Comment

by:fguerreiro_inix
ID: 1462759
So, what's your problem?
0
 

Author Comment

by:clarwc
ID: 1462760
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
 
LVL 3

Expert Comment

by:fguerreiro_inix
ID: 1462761
So, what's your problem?
0
 

Author Comment

by:clarwc
ID: 1462762
Did you see my last?  I am not able to display the records associated with the selection.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 9

Expert Comment

by:Dalin
ID: 1462763
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
 
LVL 9

Expert Comment

by:Dalin
ID: 1462764
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
 

Author Comment

by:clarwc
ID: 1462765
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
 
LVL 9

Expert Comment

by:Dalin
ID: 1462766
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
 

Author Comment

by:clarwc
ID: 1462767
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
 
LVL 9

Accepted Solution

by:
Dalin earned 100 total points
ID: 1462768
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
 

Author Comment

by:clarwc
ID: 1462769
Thanks very Much for your help.

Warren
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now