Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Interactively change table and control source
Message
 
À
06/07/2006 05:35:19
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
OS:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01134064
Message ID:
01134069
Vues:
17
>Hi Boris,
>The table structure of all the tables are EXACTLY the same. So please tell me
>how to do it. Thank you.
>
>regards
>
>
>Syan H

1. If tables are small:

I would create a cursor in Init event of the form with structure as the tables you select.
Bound all controls to that cursor.
There where you want to change control sources:
SELECT MyCursor
ZAP
INSERT INTO MyCursor SELECT .... FROM NewTable
thisform.Refresh()
That way you don't need to change anything.

2. If tables are BIG:
There where you want to change ControlSource:
thisform.ChangeSource(NULL)
USE IN OldTable
SELECT 0
USE NewTable
thisform.ChangeSource([NewTableName])



*** thisform.ChangeSource()
   LPARAMETERS lcTableName
   FOR EACH oControl IN thisform.Controls
       IF UPPER(oControl.BaseClass) == [TEXTBOX]
          IF ISNULL(lcTableName)
             *** Save old ControlSource in TAG property of TextBox
             oControl.Tag           = oControl.ControlSource

             *** Set ControlSource to NULL, so it wont complains when we close Table
             oControl.ControlSource = NULL
          ELSE

             *** Set ControlSource to NewTable, and field name we get from TAG
             oControl.ControlSource = lcTableName+[.]+JUSTEXT(oControl.Tag)
          ENDIF
       ENDIF
   NEXT
(not tested)
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform