Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can a grid show fields from two related tables correctly
Message
De
01/08/2006 06:05:59
 
 
À
01/08/2006 05:52:10
Reza Meamar
Homa Programming Group
Shiraz, Iran
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01141727
Message ID:
01142047
Vues:
12
You must set the recordsource of the grid to the master table
thisform.grid1.recordsource = "Table1"
And note that you can simplify the table setup
CLOSE DATABASES
USE "d:\00 vfp projects\alaki\table1.dbf" SHARED TAG Acode && In 0 not necessary since the last command closed the databases
USE "d:\00 vfp projects\alaki\table2.dbf" IN 0 SHARED TAG Acode
&& SELECT table1 - Not necessary since Table1 is already selected
SET RELATION TO Acode INTO table2
>Dear Tore,
>I made a form with a grid in it.
>I save my form as a class as below.
>Table1 (ACode N(5,0), Name C(10))
>Table2 (ACode N(5,0), Family C(10))
>
>I set Relation in init of form.
>But an error was occured.
>where i do wrong?
>Thanks
>
>
>**************************************************
>*-- Class:        myclass (d:\00 vfp projects\alaki\rezaclass.vcx)
>*-- ParentClass:  form
>*-- BaseClass:    form
>*-- Time Stamp:   08/01/06 02:15:08 PM
>*
>DEFINE CLASS myclass AS form
>
>
>	Top = 0
>	Left = 0
>	Height = 207
>	Width = 375
>	DoCreate = .T.
>	Caption = "Form1"
>	LockScreen = .F.
>	Name = "form1"
>
>
>	ADD OBJECT grid1 AS grid WITH ;
>		ColumnCount = 2, ;
>		DeleteMark = .F., ;
>		GridLines = 3, ;
>		GridLineWidth = 1, ;
>		HeaderHeight = 20, ;
>		Height = 120, ;
>		Left = 37, ;
>		RecordMark = .F., ;
>		RecordSource = "", ;
>		ScrollBars = 3, ;
>		Top = 36, ;
>		Width = 295, ;
>		ForeColor = RGB(0,0,0), ;
>		BackColor = RGB(255,255,255), ;
>		GridLineColor = RGB(192,192,192), ;
>		Name = "Grid1", ;
>		Column1.ControlSource = "", ;
>		Column1.ForeColor = RGB(0,0,0), ;
>		Column1.BackColor = RGB(255,255,255), ;
>		Column1.Name = "Column1", ;
>		Column2.ControlSource = "", ;
>		Column2.Width = 200, ;
>		Column2.ForeColor = RGB(0,0,0), ;
>		Column2.BackColor = RGB(255,255,255), ;
>		Column2.Name = "Column2"
>
>
>	ADD OBJECT myclass.grid1.column1.header1 AS header WITH ;
>		Caption = "Header1", ;
>		Name = "Header1"
>
>
>	ADD OBJECT myclass.grid1.column1.text1 AS textbox WITH ;
>		BorderStyle = 0, ;
>		Margin = 0, ;
>		ForeColor = RGB(0,0,0), ;
>		BackColor = RGB(255,255,255), ;
>		Name = "Text1"
>
>
>	ADD OBJECT myclass.grid1.column2.header1 AS header WITH ;
>		Caption = "Header1", ;
>		Name = "Header1"
>
>
>	ADD OBJECT myclass.grid1.column2.text1 AS textbox WITH ;
>		BorderStyle = 0, ;
>		Margin = 0, ;
>		ForeColor = RGB(0,0,0), ;
>		BackColor = RGB(255,255,255), ;
>		Name = "Text1"
>
>
>	PROCEDURE Init
>		CLOSE DATABASES
>
>		USE "d:\00 vfp projects\alaki\table1.dbf" IN 0 SHARED
>		USE "d:\00 vfp projects\alaki\table2.dbf" IN 0 SHARED
>
>
>		SELECT table2
>		SET ORDER TO TAG ACode
>		SELECT table1
>		SET ORDER TO TAG ACode
>
>		SET RELATION TO Acode INTO table2
>
>
>		thisform.grid1.column1.text1.ControlSource = "Table1.Name"
>		thisform.grid1.column2.text1.ControlSource = "Table2.family"
>	ENDPROC
>
>
>ENDDEFINE
>*
>*-- EndDefine: myclass
>**************************************************
>
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform