Prev: MD5 function?
Next: Outlook 2010 Calendar Calendar
From: BillT on 13 Jul 2010 23:39 Hello all, Another small holdup! I am following Joachim's posted code fragment for deleting selected records, viz:- nRecNo := self:oDCbBrowse:SelectionFirstRow() // get first selected record nRecHold := nRecNo -1 // hold the return record DO WHILE nRecNo > 0 self:server:goto(nRecNo) self:server:DELETE() nRecNo := self:oDCbBrowse:SelectionNextRow() ENDDO self:server:goto(nRecHold) self:server:resetNotification() self:server:Notify(NOTIFYFILECHANGE) self:oDCbBrowse:Refresh() I use VO2.8 and bB3 with Row Mode = #Absolute, SelectionMode = #Multiple and CurrentMode = #Line; I have left RowCountMode as Auto. My testing shows that this seems to be deleting only every second record!! Where have I gone wrong, please? Thanks, Bill
From: BillT on 13 Jul 2010 23:57 I should add that I have tried the alternative method suggested in the forum, of extracting an array of selected RecNos and then looping through these to delete. Same problem. Bill
From: Stephen Quinn on 14 Jul 2010 00:21 Bill > nRecNo := self:oDCbBrowse:SelectionNextRow() This code causes you to step over the NEXT record (ie after you delete a record) Eg 1 Delete - auto steps to the next rec 2 2 Pointer now here - NextRow() moves to rec 3 3 Delete - auto steps to next rec 4 4 Pointer now here - NextRow() moves to rec 5 5 Delete The pointer has to go somewhere after you delete a record and it's usually the NEXT record or EOF if no more exist CYA Steve
From: Joachim Bieler on 14 Jul 2010 01:40 Hi Bill, you forgot the self:Server:SuspendNotification() at beginning of the loop and the self:Server:ResetNotification() after the end of the loop. This is very important because the bBrowser reacts on the first delete and remove all selection. Regards Joachim Bieler Am 14.07.2010 05:39, schrieb BillT: > Hello all, > Another small holdup! I am following Joachim's posted code fragment > for deleting selected records, viz:- > > nRecNo := self:oDCbBrowse:SelectionFirstRow() // get first > selected record > nRecHold := nRecNo -1 // hold the return record > > DO WHILE nRecNo> 0 > self:server:goto(nRecNo) > self:server:DELETE() > nRecNo := self:oDCbBrowse:SelectionNextRow() > ENDDO > > self:server:goto(nRecHold) > self:server:resetNotification() > self:server:Notify(NOTIFYFILECHANGE) > > self:oDCbBrowse:Refresh() > > I use VO2.8 and bB3 with Row Mode = #Absolute, SelectionMode = > #Multiple and CurrentMode = #Line; I have left RowCountMode as Auto. > > My testing shows that this seems to be deleting only every second > record!! Where have I gone wrong, please? > > Thanks, > Bill
From: BillT on 14 Jul 2010 02:00
Thanks Steve, I thought that if I followed Joachim's posted code that I would be OK. I suspected that what you say was happening, that's why I tried the alternative of creating an array of RecNos and then driving the deletes from that array. I'll have to think it through, maybe that also suffers from the skipping problem that you refer to? Hi Joachim, No, I do have a self:Server:SuspendNotification(), just failed to include it in the post. The Reset is already shown in my post. I believe that it shouldn't make any difference, but perhaps I should mention that my database is SQL (MS Access). I am not clear what you mean by "the bBrowser reacts on the first delete and remove all selection. " I have included an InfoBox to display recnos on each pass and it shows the correct recnos. I have also tried replacing the loop with self:oDCbBrowse:SelectionRemove(#ALL) and that didn't work properly either. I am not sure whether that is the correct us of SelectionRemove anyhow? Regards, Bill |