A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Moving to previous row



 
 
Thread Tools Display Modes
  #1  
Old November 13th, 2006, 01:57 AM posted to microsoft.public.access.forms
vm
external usenet poster
 
Posts: 7
Default 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  
Old November 13th, 2006, 02:41 AM posted to microsoft.public.access.forms
Van T. Dinh
external usenet poster
 
Posts: 1,048
Default 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  
Old November 13th, 2006, 03:38 AM posted to microsoft.public.access.forms
vm
external usenet poster
 
Posts: 7
Default 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  
Old November 13th, 2006, 06:52 AM posted to microsoft.public.access.forms
Van T. Dinh
external usenet poster
 
Posts: 1,048
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:21 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.