If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Moving to previous row
I am connecting to an access db via vb6. I have put the standard 4 buttons
for First Record, Previous Record, Next Record, & Last Record. The buttons for First & Last record work well, they are justrs.movefirst & rs.movelast. The problem is with the previous & next buttons whenit comes to the first & last record respectively. My code for the previous button is: if rs.BOF = true then rs.movefirst else rs.movePrevious displayIt '{DisplayIt is a sub to fill values into text fields} end if The problem is that rs.BOF is never true. Even when I move to the first record, the rs.BOF is false. The same is true of the next button using the rs.EOF check. It is always false. Of course since it is false it tries to display the previous {and next} record - it errors out with "No current record" This seems simple enough, but why won't the BOF & EOF flag true if it is at the beginning or end of file. All other aspects of the code with the db is working perfectly, new, delete, search, update. Any ideas? vm |
#2
|
|||
|
|||
Moving to previous row
Check your VB Help on the Property AbsolutePosition of the Recordset.
-- HTH Van T. Dinh MVP (Access) "vm" wrote in message ... I am connecting to an access db via vb6. I have put the standard 4 buttons for First Record, Previous Record, Next Record, & Last Record. The buttons for First & Last record work well, they are justrs.movefirst & rs.movelast. The problem is with the previous & next buttons whenit comes to the first & last record respectively. My code for the previous button is: if rs.BOF = true then rs.movefirst else rs.movePrevious displayIt '{DisplayIt is a sub to fill values into text fields} end if The problem is that rs.BOF is never true. Even when I move to the first record, the rs.BOF is false. The same is true of the next button using the rs.EOF check. It is always false. Of course since it is false it tries to display the previous {and next} record - it errors out with "No current record" This seems simple enough, but why won't the BOF & EOF flag true if it is at the beginning or end of file. All other aspects of the code with the db is working perfectly, new, delete, search, update. Any ideas? vm |
#3
|
|||
|
|||
Moving to previous row
Tat wasn't it, but I was able to figure it out...
Thanks "Van T. Dinh" wrote: Check your VB Help on the Property AbsolutePosition of the Recordset. -- HTH Van T. Dinh MVP (Access) "vm" wrote in message ... I am connecting to an access db via vb6. I have put the standard 4 buttons for First Record, Previous Record, Next Record, & Last Record. The buttons for First & Last record work well, they are justrs.movefirst & rs.movelast. The problem is with the previous & next buttons whenit comes to the first & last record respectively. My code for the previous button is: if rs.BOF = true then rs.movefirst else rs.movePrevious displayIt '{DisplayIt is a sub to fill values into text fields} end if The problem is that rs.BOF is never true. Even when I move to the first record, the rs.BOF is false. The same is true of the next button using the rs.EOF check. It is always false. Of course since it is false it tries to display the previous {and next} record - it errors out with "No current record" This seems simple enough, but why won't the BOF & EOF flag true if it is at the beginning or end of file. All other aspects of the code with the db is working perfectly, new, delete, search, update. Any ideas? vm |
#4
|
|||
|
|||
Moving to previous row
There are a number of different methods. In Access, we can use the Form's
CurrentRecord which I don't think available in VB6. BTW, you should post your solution so that others who have similar problems can see your solution ... -- HTH Van T. Dinh MVP (Access) "vm" wrote in message ... Tat wasn't it, but I was able to figure it out... Thanks |
Thread Tools | |
Display Modes | |
|
|