Re: Need some help with MOVENEXT/MOVEPREVIOUS



John,
There's no point in asking me -  try it
Argusy

John wrote:
Argusy,
Thanks for the reply. The example I gave was not the whole thing. In fact MYFIELD in the db is a numeric key field. So '123' is record with key 123.
I do understand why the movenext won't work, now.
So the solution yoy gave, can it be used for keyed fields too or is ther e another way?


tia
John


"argusy" wrote:


John

Your database has only one record with '123' in MYFIELD
That's why opening the database then opening a recordset query works.
The movenext also works because it is moving to the end-of-file marker
of the created recordset
Note I wrote --marker---.
The end-of-file is actually a dummy or false record, but with no data.
That's why the failure - it's now NOT a current record (it's beyond the
EOF marker)

I'm making a couple of assumptions
It's an access database
you want the recordset to start with MYFIELD at '123'
you want the remainder of the table.
In that case, your query should be "SELECT * WHERE MYFIELD => '123'".

Since your query DOES extract one record, MYFIELD's type is a string.
Open your database in access and do a sort on MYFIELD.
See how the numbers are sorted
Then you'll see why you should be careful when using a string field to
store numbers, and what you may get in a recordset mightn't be what you
have expected

Also go to the last (blank) "record".
It's not a record until you put something into any field. Once you do,
another "record" is created on the next line. That should also give
you a clue as to why you're getting the error message

I'm not going to ask you why are you transferring the data to another table
That's like opening Pandora's box

Argusy



John wrote:

Hi,
I'm building an application, using DAO with VB6 (sp6) and I encountered the following problem:
I open a recordset (rs), select a record by using e.g. SELECT * WHERE MYFIELD="123".(placed in a string)
This works, I get the record. (db contains 640 records, the select retreives the third record) I use a routine that places all the fields into a table recordtype. Doing the select and the routine, the table is filled with the requested record.
Thereafter I do a rs.MoveNext and I try to retrieve the fields, but than the error that there is no current record occurs.
So, the sequence is:
1) open db and recordset
2) select the record by using a search argument (lets say to set a certain starting point)
3) than a movenext to obtain the next record
4) using the record fields by placing them in a table
5) close the rs and db
1 and 2 works fine
3 seems to work, no error occurs
4 gives the error: No current record
abort of the routine


Can anyone help me, please?

Regards,
John









.



Relevant Pages

  • Re: Need some help with MOVENEXT/MOVEPREVIOUS
    ... MYFIELD in the db is a numeric key field. ... John ... "argusy" wrote: ... > That's why opening the database then opening a recordset query works. ...
    (microsoft.public.vb.database.dao)
  • Re: Permission to open database
    ... John I got it to work with the code below I got from an example I found. ... Dim rst As DAO.Recordset ... "Please contact the Database Adminstrator for assistance.", ... "WelcomeForm" ...
    (microsoft.public.access.gettingstarted)
  • Re: Exporting Info To Word File
    ... degree of automation) to get individual records from an existing databse when ... need from my database. ... "John Nurick" wrote: ... >>> document from the template, and place the information in the bookmarks ...
    (microsoft.public.access.externaldata)
  • Re: Communication Log
    ... "John Marshall, MVP" wrote: ... Visio MVP ... May I send you copy of the database that I made? ... a communication log in the database so that it will store the Date, ...
    (microsoft.public.access.tablesdbdesign)
  • Re: Export Project notes to Access or Excel
    ... John: I have the same problem as the OP. ... Unfortunately SQL Reporting Services does not have a text field that will ... The macro couldn't get past the 'Dim cn ... Actually you CAN use the code you found in the Project database ...
    (microsoft.public.project)