Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Working with two tables
Message
From
01/02/2004 10:03:15
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
31/01/2004 19:03:57
Fil John Mates
E-Fildan Computer Software System
Davao, Philippines
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00872720
Message ID:
00872767
Views:
13
>hi to all.
>
>can u give me program sample with two tables a header and detail.
>i have no idea how to do that. i know only single table.im confuse
>special when i make a previous and next botton.i dont know how to do it
>if i will click the next botton the header and the detail tables will
>move the same time in its corresponding record.
>
>hope u can help me.
>
>thanks
>
>john

The first thing you have to think about is the visual design. Even for a single table, this is complicated; you may want to have a grid (for searching through several records, including incremental search), and textboxes and other controls (for the actual editing). I mean, if you have 10,000 records, you won't just let the user press "Next" 5000 times to go to the middle of the table.

For two tables, you might have each table on a separate page, in a pageframe (or simply in different containers). Or, you can have the parent and the child in different forms, and somehow link the forms. I use this with the Visual Extend framework, and it works very well.

As to the actual commands, all you need to do, assuming the tables are called "parent" and "child":
select parent
skip
Similar for child.

Well, actually, this code can give you an end-of-file error, so you need to check for EOF before and after. Also, you need to refresh the form:
select parent
if not eof()
  skip
endif
if eof()
  go bottom
endif
ThisForm.Refresh()
Moving the record in the parent table may move the record in the child table, if the two are related. If you want to control this yourself, you may have to go to the DataEnvironment and delete the relation.

HTH,

Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Reply
Map
View

Click here to load this message in the networking platform