Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Setting Relations
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Database:
Visual FoxPro
Divers
Thread ID:
01470421
Message ID:
01470427
Vues:
28
>Hi Naomi,
>
>While you were responding, I had barely updated my posting to include some code. There is no adding of a child record, only attaching it via the relation setting, since there is always only one child record (yeah, I know, it's weird.)
>
>I rewrote my code, based on what you stated, that the relationship is broken when you add a new record. I added the follwoing, and it worked very well:
>
>SELECT Quotes
>SET RELATION OFF INTO Costs
>SET RELATION TO CostsID INTO Costs ADDITIVE
>
>
>
>DoDefault()	&& Execute the code in the Visual Class first,
>			&& then execute the following:
>WITH ThisForm
>	* If the user hits the NEW button, and is adding a new record,
>	* we need to grab the value in the array for the CostsID and
>	* put that value into the Quotes.CostsID field.
>	IF ThisForm.lAppendMode
>		REPLACE Quotes.CostsID WITH .aCostsID[1]
>	ENDIF
>	* Repeat this SET RELATION since adding a new record to the parent
>	* may break the relation.
>	SELECT Quotes
>	SET RELATION OFF INTO Costs
>	SET RELATION TO CostsID INTO Costs ADDITIVE
>	Replace ;
>		Quotes.dQuote WITH DATE(),;
>		Quotes.SB_Tax_Rat WITH ThisForm.aTaxRate[1]
>	.Refresh()
>	.CheckForMaterial()
>	.CheckForAluminum()
>	.cPageFrame1.cPage1.cboCustomer.SetFocus()
>ENDWITH
>
Ok, glad it worked.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform