Re: Need some help with MOVENEXT/MOVEPREVIOUS



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
    ... John wrote: ... Your database has only one record with '123' in MYFIELD ... That's why opening the database then opening a recordset query works. ... Doing the select and the routine, the table is filled with the requested record. ...
    (microsoft.public.vb.database.dao)
  • Re: Need some help with MOVENEXT/MOVEPREVIOUS
    ... 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 ...
    (microsoft.public.vb.database.dao)
  • Re: INSERT from DataSet with generated PKey
    ... With MyTable having MyKey Int, Identity and MyField VARCHAR ... > I have read about the OnRowUpdating and OnRowUpdated event handlers, ... > inserted into the database, ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Calculate certain number of records
    ... Since the value to be matcheds is text, I take it that MyField is a Text ... Tips for Access users - http://allenbrowne.com/tips.html ... Getting a value from a table: DLookup() ...
    (comp.databases.ms-access)
  • Newbie adding records to a table automatically
    ... The datWeekends data control is linked to the TWeekends table in the database, which contains a single field "Date". ... Private Sub addWeekends() ... Dim newDate As Date ... Where myfield is ADODB.Field datatype. ...
    (microsoft.public.vb.database.ado)