PDA

Click to See Complete Forum and Search --> : regarding the display of 1 to Many in DBGRID


Girl
Sep 17th, 1999, 10:03 PM
Hi,

I've fully completed my project but the only flaw is I dunno how to retrieve a list of
1 to Many relationship's records in DBGRID.
For a simple example as listed below

----------------------------------
ID Name Age Course |
----------------------------------
01 John 19 MS ACCESS
01 John 19 MS WINDOWS
01 John 19 MS POWER POINT
02 Joe 20 MS ACCESS
02 Joe 20 MS PUBLISHER
03 WAYE 21 VB
03 WAYE 21 PASCAL

ID, Name, Age is in <b>Student Table</b>, Course is in <b>Course Table</b>, the relationship of these two tables is 1 to Many in which a student can enrol in many courses as possible.
As I use Data Control and the following method

DataControl.RecordSource = SQL
DataControl.Refresh
(DBGrid is bound to DataControl).
I get the result as shown above, there're
7 records being called by DataControl and listed in DBGRID.

My point is, how can I get the outcome as shown below, where the fields in <b>Student Table</b> just occur once no matter how many courses the student enrol in, and the DataControl will show there're only 3 (based on the number of ID occurence) records but NOT 7 (based on the number of Course occurence) anymore.
----------------------------------
ID Name Age Course |
----------------------------------
01 John 19 MS ACCESS
MS WINDOWS
MS POWER POINT
02 Joe 20 MS ACCESS
MS PUBLISHER
03 WAYE 21 VB
PASCAL
----------------------------------------

Is my idea possible in VB ? Please and Thank you very much, eagerly waiting for solution.