Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Appended record missing in another data session
Message
From
14/07/2004 08:06:40
Yh Yau
Ingenuity Microsystems Sdn Bhd
Kuala Lumpur, Malaysia
 
 
To
13/07/2004 07:14:15
Neil Mc Donald
Cencom Systems P/L
The Sun, Australia
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00902364
Message ID:
00924134
Views:
58
Neil,
May be, Here's the code
On the forms, users click on a search button to call a search screen. Here's the code in the search screen. Basically the search screen retrieves a document number. Based on the document number, we do a search on the base table for the surrogate key. With the surrogate key, we have an assign method on the "thisform.lcreckey" property that refreshes the value of the views.

Search screen code
lckeyv=thisform.fieldaname
lckey=alltrim(thisform.headername)+"."+alltrim(thisform.headerkey)
do form genhelp with thisform.headername,thisform.fieldaname,thisform.fieldbname,;
1,thisform.frm_mode, "", 1, thisform.qfilter to lcsrch
if thisform.frm_mode="E" or thisform.frm_mode="C"
	if !empty(lcsrch)
		select (thisform.detailname)
		locate
		go bott
		select (thisform.headername)
		scan for &lckeyv = lcsrch &lcfilter
			thisform.lcreckey=&lckey
			thisform.frm_doc_no=thisform.firstfield.value
			thisform.grdtotal
			exit
		endscan
	endif 
	thisform.secondfield.setfocus
else
	thisform.firstfield.setfocus
endif	

Here's the lcreckey assign method

LPARAMETERS vNewVal
local lcreckey, lcfile
THIS.lcreckey = m.vNewVal
lcfile=select()
lcreckey=this.lcreckey
if lcreckey=0
	thisform.lcpartyname=""
endif	
select fheader
		
if getnextmodified(0)<>0
	=tablerevert(.t.,"fheader")
endif	
=requery("fheader")
select fdetail
if getnextmodified(0)<>0
	=tablerevert(.t.,"fdetail")
endif	
=requery("fdetail")
if thisform.autonumdoc="SI" or thisform.autonumdoc="PI" or thisform.autonumdoc="SV" or ;
thisform.autonumdoc="PV"
	select tdocterm
	locate
	go bott
	select v_tdocterm
	if getnextmodified(0)<>0
		=tablerevert(.t.,"v_tdocterm")
	endif
	=requery()
	thisform.m_redrawgrid2()
endif		
if !empty(lcfile)
	select (lcfile)
else
	select 0
endif		
thisform.refresh()
The scan .. endscan loop in the search button code is where the problem lies. Although the search screen manages to retrieve the document number appended by other PCs, the scan can't locate the document number (hence can't return the surrogate key. The search screen is a form with default data session and hence is sharing with the base form.

If we close the form, reopen it, then the search works!

Yau
Previous
Reply
Map
View

Click here to load this message in the networking platform