More datatables on one form

Startbeitrag von Rudi Werner am 11.04.2013 12:18


I have a two linked database tables
I created a table view on one of them
then i create a update form with fields from both tables.

How can i make that the fields from the second linked table are also viewed when i go from
the tableview to the form

with filetoscreen() he updates only the table from the table view


Hi Rudi

1. In wlanguage, there is no database tables, we are talking about FILES

2. I'm guessing that what you call table VIEW, we call TABLE, or table control

3. What you call a form, we call a WINDOW (in windev, or PAGE in webdev)

All this so that you question is as clear as posible for us old windevians :-)

Now, about your question, the answer may depend on a lot of things, as there are always different way to do things...

FileToScreen does NOT transfer data from the table control, but from the current record in the FILE.

If you use a table linked to a file, then the current line of the table = the current record in the file and FileToScreen can work

Now, of course, filetoscreen will load data only from the curent record of the current file or (if FileToScreen(OneSpecificFile)) from the OneSpecificFile...

So what you need to do is to read the record from the second file with a hreadseek. I'm guessing that you have the ID of one record in the other, and the hreadseek will aloow you to find the needed record.

Once the record from the second table is read, you can do a FileToScreen(MySecondFile)

Best regards

von Fabrice Harari - am 11.04.2013 14:23
Hi the screentoflie() function adds all connected stuff to the screen. This is easy coding but you can do it by hand as well. It might be easier to grasp.

Here is a little coding that does the job ( It is not checked I just typed it in so there might be little typo errors)
Place the code In the “row select section” of the table. ( the thing you call table view)

//First look for the ID of the record of the table
Hreadseekfirst( filename, file ID, tablename)
// tablename is the name of the table ( tableview)
If Hfound( filename) then
// then fillup the controls in your edit screen
FOR each filename where filename.fileID = secondfile.fileid
Controlname = filename.item
Controlname = secondfile.item
// control can be like EDT_name for an edt control
Error( “item not found)
Now your form is filled with the corresponding records. If you want to modify you can change the values the way you want. Then you need to modify them
// with hmodify() you can save the modifications. You have to do a modify on both files.
Filename.item = controlname
Secondfile.item= controlname
Hmodify( filename)

von Allard - am 22.04.2013 10:11
Zur Information: hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.