Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
TableUpdate in View
Message
From
09/08/2000 17:30:49
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
TableUpdate in View
Miscellaneous
Thread ID:
00403088
Message ID:
00403088
Views:
49
I have a form with a Grid (using View, updateable, buffermode = 5)... before the grid appears, on the form it prompts the user to enter a value to retrieve records from the table (100,000+ records) then a grid appears (a view with anywhere between a couple records to a few hundred records)... in testing my view retrieved 248 records, I made a change to just one record... clicked save (=tableupdate(1,.T.,"TAcustView")), a message "Running query...." with a progress bar appeared, and it went into a loop 9 times then it finished. I tried again with a different value, changed one record, it looped 11 times. Another value, it retrieved just a few records, it looped once. That's really strange... why? I checked the modified records (as well as the appended records) and all appears OK... but I find it puzzling that =tableupdate would "requery" too many times....

Here's the code:

* after prompting user for a value, pass it to SQL View to retrieve records
PROCEDURE txtTAID.LostFocus
if empty(this.value)
* if blank, ask user if wish to cancel
if msg(1,'TA Rep#')
thisform.cmdQuit.click()
return
else
thisform.txtTAID.setfocus()
endif
endif
select TAcustView
mTAID = this.value
requery()
if reccount() = 0
msg(12,'No Assigned CMRs for this TA')
thisform.txtTAID.setfocus()
Endif
ENDPROC

* save changes (relinquish CMR assignment(s) from one TA rep to another TA rep)
PROCEDURE clsdtlbtns.cmdSave.Click
local mRecNo
select TAcustView
go top
do while not eof()
if not empty(TAcustView.assumer) and TAcustView.actflag = .T.
mRecNo = recno()
scatter memvar
m.taid = m.assumer
m.effmo = thisform.txtEffMo.value
m.effsysdt = datetime()
m.assumer = space(6)
m.user = gcUser
insert into TAcustView from memvar
go mRecNo
repl endmo with m.effmo, endsysdt with datetime(), actflag with .F.
endif
skip
enddo
=tableupdate(1,.T.,"TAcustView")
thisform.showdetails(.F.)
ENDPROC

And in the SQL View:

SELECT Tacust.*, Cmr.cmrname;
FROM crsdata!tacust LEFT OUTER JOIN crsdata!cmr ;
ON Tacust.cmrno = Cmr.cmrno;
WHERE Tacust.taid = ?mtaid;
AND Tacust.actflag = .T.
ORDER BY Tacust.cmrno, Tacust.effmo, Tacust.endmo


TIA
Thanks!
~d
J
Next
Reply
Map
View

Click here to load this message in the networking platform