Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Parent-child form question
Message
From
13/03/2000 05:12:11
 
 
To
10/03/2000 10:28:26
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00344200
Message ID:
00344895
Views:
20
Hobby,

I don't know if this is the best solution, but with parent_child I always work with an internal key, which :
- is generated the moment a new parent is created
- not visible to the user
- is used as PK in the parent
- is used also in the child, related to the parent

the moment the document is accepted (saved), only then I attribute the document number. So this document number has nothing to do with the parent-child relation.

Why ?
- if 2 users are creating documents, you have to wait until they decide to save , to give a document number, because if not, if the one that first started (and got for example n° 1000) cancels his document, you will have a whole in the numbering cause the second got 1001 (and doesn't cancel his document).
- this in mind you still need a key that relates parent with child, when you start creating the first child.


>Hi all,
>
> I am working on a parent child form which is used to make purchase orders. I use 2 views for this form(one I called purchase_order, the 2nd is purchase_item) They are related to each other by a field I called po_no(automatic no. from the SQL Server)
> On this form I have to add the parent part first and then the child part. The po_no(which is the connection between 2 views) does not show up until I have this code(on the buttonset)
>*******
>if (thisform.PO_NO_ID1.value = 0) and
> (thisform.buttonset1.cmdadd.caption = "\> =requery()
> thisform.refresh()
>endif
> dodefault()
>*******
> I do "requery" to get the po_no which is needed for the child part. But my problem here is after I requery, the first record(on the parent part) always comes up on the screen. I just want to stay at the record I just added(from parent part), then I can add more child records.
> Any suggestions would be appreciated.
> Thanks in advance.
Previous
Reply
Map
View

Click here to load this message in the networking platform