Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Data Buffering, Pessimistic & Optimistic locking and suc
Message
From
14/12/2006 00:11:22
Yh Yau
Ingenuity Microsystems Sdn Bhd
Kuala Lumpur, Malaysia
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
01177438
Message ID:
01177482
Views:
8
William,
Brings back memories way back.
Suggest you use views for data entry, use the default values within your primary key fields to generate the autonumber that act as the foreign key for the child table

Something like :-
use headertablename share in 0
use view_header nodata share in 0
use view_detail nodata share in 0
=cursorsetprop("buffering",5,"view_header")
=cursorsetprop("buffering",5,"view_detail")
code for append records in header /detail

Upon saving
begin transaction
if tableupdate(view_header) (let the default value generate the key)
m.primary_key = headertablename.primary_key_field
select child
scan
replace child foreign key with m.primary_key_value
endscan
if tableupdate(view_detail)
end transaction
else
rollback
endif

I'm using my own codes for the default values generation at present.
HTH
Yau
Previous
Reply
Map
View

Click here to load this message in the networking platform