Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
GETNEXTMODIFIED with new records
Message
From
11/06/1998 17:13:31
 
 
To
11/06/1998 16:42:12
Bruce Gilmour
Cal-Mour Consultants
Calgary, Alberta, Canada
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00106948
Message ID:
00107378
Views:
30
OK, Bruce, I ran the exact code you posted with the exception that I opened the table with USE...SHARED, did a CURSORSETPROP("Buffering",5) and then changed 3 records through a replace and then an INSERT INTO to add a record.

I also do not have an active index.

Everything worked fine. No errors. Now what are those two Form methods, removeqty and adqty doing?


>I think you may be on to something. Here is the code I am using. In test I have changed record 1, 3, 7 and added one record -1. It starts with 1 goes to 3 then 7 then -1. It works fine until it does the qty update for the new record and then when trying to get a return of 0 using GETNEXTMODIFIED(lnchgrec) where lnrec is -1 it gives me the aforementionned error.
>
> SELECT polines
> SET FILTER TO polines.ponumber = poheader.ponumber
> lnchgrec = GETNEXTMODIFIED(0)
> DO WHILE lnchgrec <> 0
> wait window str(lnchgrec)
> go lnchgrec
> lcolditem = ""
> lnoldqty = 0
> IF lnchgrec > 0
> lcolditem = OLDVAL("polines.itemnumber")
> lnoldqty = OLDVAL("polines.qtyordered")
> ENDIF
> lcnewitem = polines.itemnumber
> lnnewqty = polines.qtyordered
> llError = !TABLEUPDATE(0,.T.)
> IF !llerror
> thisform.removeqty(lcolditem,lnoldqty)
> thisform.addqty(lcnewitem,lnnewqty)
> ENDIF
> lnchgrec = GETNEXTMODIFIED(lnchgrec)
> ENDDO
> SET FILTER TO
>
>And - no - I am adding the record directly to a buffered table.
>
>>Are the records being directly added to a table that is buffered -or- is it possible that you're adding records to an unbuffered view? Also, you do know that record numbers for appended records in a buffered table are negative and may not be caught if you use ther default 0 for starting record number in GETNEXTMODIFIED parms.
>>
>>
>>>I am using GETNEXTMODIFIED in grids to scan changed records and use the data enetered to update fields in other files. The problem is, there can also be new records in the grid and when GETNEXTMODIFIED hits them, VFP tells me that buffering is not enabled (it is) What is the easiest way around this. I am trying to do it in one section of code. Do I have to code differently for new records? Any help appreciated
------------------------------------------------
John Koziol, ex-MVP, ex-MS, ex-FoxTeam. Just call me "X"
"When the going gets weird, the weird turn pro" - Hunter Thompson (Gonzo) RIP 2/19/05
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform