Re: Need some help with MOVENEXT/MOVEPREVIOUS



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: SQL CE 3.5 and Data Loss on SD Card
    ... with a database on SD card I would be greatful. ... devices we have experienced only one corrupted SDF database. ... I attribute our success to opening a connection just before every DB access ...
    (microsoft.public.sqlserver.ce)
  • Re: 2002 database corrupt and unuseable after upgrading to Access
    ... >> This refers to an empty class module. ... >> Opening the database with the shift key down bypasses the autostart form, ... >> but then opening the VBA code produces the same sequence of errors. ...
    (microsoft.public.access.conversion)
  • Re: SQL commad each time I open MS Word
    ... Opening this document will run the following SQL command: ... information from a database -for example, if your document is a form letter ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: Prevent database open if already open by a user
    ... I added 1 field to the receiving table and called it "Lock". ... this lock during the close operation, when the user exits the database. ... developing because this particular database needs to be set up for one user ... it does not prevent the DB from opening or operating. ...
    (microsoft.public.access.modulesdaovba)
  • Re: GP
    ... Are you using a database (.MDB) backend on your application? ... It is possible that the msgbox proclaiming the error opening the file is the ... What opens the first form? ...
    (microsoft.public.vb.general.discussion)

Loading