Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Setting Relations
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01470421
Message ID:
01470427
Views:
27
>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
Previous
Reply
Map
View

Click here to load this message in the networking platform