By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,392 Members | 1,576 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,392 IT Pros & Developers. It's quick & easy.

vba function movenext does not work

P: 1
Hi,

I have written a code to display records from the ms access table on a form using text boxes, combos. When I execute the rs.movenext command ideally it should move to the next record in the table and display the same which is not happening

Here is the code

rs1.MoveFirst

While Not rs1.EOF
Text1 = rs1.Fields(0)
DTPicker0.Value = rs1.Fields(1)
Text4 = rs1.Fields(2)
Text6 = rs1.Fields(3)
Text8 = rs1.Fields(4)
rs1.MoveNext
Wend

Can some body help me in this
Aug 7 '07 #1
Share this Question
Share on Google+
4 Replies


missinglinq
Expert 2.5K+
P: 3,532
I see nothing wrong with the code you've posted, but we really need to see the rest of the code that goes with this, i.e. the code for entire sub/event. We aso need to know how you're displaying this retrieved data.

Welcome to TheScripts!

Linq ;0)>
Aug 7 '07 #2

ADezii
Expert 5K+
P: 8,669
Hi,

I have written a code to display records from the ms access table on a form using text boxes, combos. When I execute the rs.movenext command ideally it should move to the next record in the table and display the same which is not happening

Here is the code

rs1.MoveFirst

Expand|Select|Wrap|Line Numbers
  1. While Not rs1.EOF
  2.   Text1 = rs1.Fields(0)
  3.   DTPicker0.Value = rs1.Fields(1)
  4.   Text4 = rs1.Fields(2)
  5.   Text6 = rs1.Fields(3)
  6.   Text8 = rs1.Fields(4)
  7.     rs1.MoveNext
  8. Wend
Can some body help me in this
How are 'you' executing a Recordset MoveNext while it is contained within a Loop? As soon as the code is executed, you will instantly be at the Last Record in the Recordset and the Text Boxes and DTPicker Control will display the appropriate values from this Last Record. Are you sure that you are not referring to the manual navigation (MoveNext) through a Form's Records via DoCmd.GoToRecord , , acNext?
Aug 8 '07 #3

missinglinq
Expert 2.5K+
P: 3,532
That's why I asked how he was displaying the retrieved data! If you put a messagebox in just before the MoveNext statement you can step thru the records one at a time, but without that they zip thru just like you said. Of course, we don't know that the recordset has been set up correctly since we haven't seen that part of the code.

Linq ;0)>
Aug 8 '07 #4

ADezii
Expert 5K+
P: 8,669
That's why I asked how he was displaying the retrieved data! If you put a messagebox in just before the MoveNext statement you can step thru the records one at a time, but without that they zip thru just like you said. Of course, we don't know that the recordset has been set up correctly since we haven't seen that part of the code.

Linq ;0)>
We'll just have to wait and see as always.
Aug 8 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.