On Friday, December 03, 2010 12:49:39 pm Paul McNett wrote:
> On 12/3/10 12:45 PM, Grant Paton-Simpson wrote:
> >    Hi Paul,
> > 
> > It was the second that I meant - the ability to have a main form with a
> > linked subform.  For example, you might have a main form displaying
> > editable data for a specific teacher such as name, qualifications etc,
> > and a linked subform (linked by a teacher id) displayed on the main
> > form, containing a list of student records (name, contact details etc)
> > for students of that teacher.  I briefly skimmed the wiki looking for
> > guidance on how to do that but I didn't see it labelled in the
> > terminology I was expecting.  Is there a wiki page on this specific
> > process that can get me started?  Apologies if I am asking something
> > obvious to experienced DABO users but I am deciding whether this is
> > worth investing a lot of time in or not.
> > 
> > In MS Access, I would make a subform e.g. fsub_students and put on the
> > student controls e.g. txtfname.  The underlying table might be
> > students.  I would then make a form called frm_teachers and add controls
> > like txtqualifications.  I would also add the control fsub_students
> > selecting teacherid as the linked field. I could also choose to display
> > the subform data as continuous forms or as a datasheet for example.  I
> > might also decide to allow data entry into the subform.
> > 
> > 
> > All the best, Grant
> 
> All I have time right now to say is "yes, you could do all that with Dabo."
> I promise to try to whip up some examples someday but I'm overcommitted
> right now (have been for going on 4 years now).
> 
> Can anyone else offer some examples for Grant?
> 
> Paul

Hi Grant and Welcome to the wonderful world of Dabo,

As Paul has suggested - all of what you are describing is more than possible.

Just a little background first:

Just like with VB6, we use the term form to describe the windows/frames that 
contain controls.  Normally, the controls are associated with data (fields 
from a table).  Such as a text box control that is  associated with the first 
name from the customer table.  You get the idea.  

To allow the association of fields from a table to take place you have to 
create a bizObj (in some circles this would be called a model).  The bizObj 
describes the table name, field names, etc...  BTW Dabo's bizObjects are very 
powerful - more than what I recall Access can do.  You can check out the wiki 
for  a good description of a bizObject .

Now to the question.  Like many things in the programming there are several 
ways to do what you want.  Which you choose depends on your exact needs.  

It appears that you have reviewed (maybe played with) Dabo and it make sense 
that the first form (maybe the parent form) has access (and more) to the data 
in the  tables.   I'll assume you agree and understand.  So the question is 
how does a sub-form (child form) have access to the same data.

When you call the child form you can 
1. pass the data environment.
    a. you could pass "self" (the instance of the parent form) to the sub-
form.  Nice you never have to worry you missed anything.
    b. you could pass just the instance of the biz object (the table).  All 
saves, updates, deletes effect both forms.

2. just pass the primary key of the table
   a. you could set up a new bizObj that will use the PK.  Nice because you 
now are using the same table twice.
   b. you could use the PK to execute direct SQL statements (yes Dabo allows 
it).  Very nice if you a very special need.

Also Dabo is very good with Parent->Child->GrandChildren associations of 
tables.  In fact it's almost transparent most of the time.  So in the case you 
describe.   I think I would just setup a couple tabs (all on the same form) 
and setup the parent child relationships.  That way  I wouldn't even worry 
about keeping the data in sync during saves, updates, deletes, or inserts (new 
records).  Dabo handles all of it.  

In fact what you are describing I do almost 100 % of the time.  On all the 
forms I create there are parent bizObj's and children bizObj's.  I set up 
three lines of code and it's done.

Johnf


    
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: 
http://leafe.com/archives/byMID/[email protected]

Reply via email to