From: Martin on 16 Mar 2010 13:33 On Tue, 16 Mar 2010 10:57:40 -0500, Paul Clement <UseAdddressAtEndofMessage(a)swspectrum.com> wrote: >� > >Keep in mind that when you use Seek or FindFirst and there is no match, the pointer in the Recordset >is actually in no mans land. Both BOF and EOF will be False. That's why it's a good idea to perform >a MoveFirst or Move to a current row in the Recordset when NoMatch is True. > If I do a .Seek and get a .NoMatch then I'm going to be doing either an .AddNew or I'm going to be doing nothing further with that recordset. So why does it matter where the record pointer is? An .AddNew is not affected by the status of BOF or EOF is it? And, if I'm taking no further action with the recordset, then the record pointer has no bearing on things does it? BTW, I'm not trying to argue with anyone here, I'm truly trying to understand just how this works.
From: Henning on 16 Mar 2010 16:21 "Martin" <ironwoodcanyon(a)gmail.com> skrev i meddelandet news:jnfvp5lv3ck85trkf94vujm8dkgo6votam(a)4ax.com... > On Tue, 16 Mar 2010 10:57:40 -0500, Paul Clement > <UseAdddressAtEndofMessage(a)swspectrum.com> wrote: > > >>� >> >>Keep in mind that when you use Seek or FindFirst and there is no match, >>the pointer in the Recordset >>is actually in no mans land. Both BOF and EOF will be False. That's why >>it's a good idea to perform >>a MoveFirst or Move to a current row in the Recordset when NoMatch is >>True. >> > > If I do a .Seek and get a .NoMatch then I'm going to be doing either > an .AddNew or I'm going to be doing nothing further with that > recordset. So why does it matter where the record pointer is? > > An .AddNew is not affected by the status of BOF or EOF is it? > > And, if I'm taking no further action with the recordset, then the > record pointer has no bearing on things does it? > > BTW, I'm not trying to argue with anyone here, I'm truly trying to > understand just how this works. > What happens if you do a MoveFirst before doing the Seek? I'm only using SQL queries when accessing db's, so I don't know what happens if the Seek is performed when the last record is the current. /Henning
From: Paul Clement on 16 Mar 2010 17:14 On Tue, 16 Mar 2010 10:33:10 -0700, Martin <ironwoodcanyon(a)gmail.com> wrote: � >Keep in mind that when you use Seek or FindFirst and there is no match, the pointer in the Recordset � >is actually in no mans land. Both BOF and EOF will be False. That's why it's a good idea to perform � >a MoveFirst or Move to a current row in the Recordset when NoMatch is True. � > � � If I do a .Seek and get a .NoMatch then I'm going to be doing either � an .AddNew or I'm going to be doing nothing further with that � recordset. So why does it matter where the record pointer is? � � An .AddNew is not affected by the status of BOF or EOF is it? � � And, if I'm taking no further action with the recordset, then the � record pointer has no bearing on things does it? � � BTW, I'm not trying to argue with anyone here, I'm truly trying to � understand just how this works. No problem. After calling AddNew and Update the record pointer is still in no man's land (e.g. no current record). Like I said, try a MoveFirst or a Move to establish a valid row position in the Recordset. Paul ~~~~ Microsoft MVP (Visual Basic)
From: Nobody on 16 Mar 2010 17:23 "Henning" <computer_hero(a)coldmail.com> wrote in message news:%23HOaWZUxKHA.2432(a)TK2MSFTNGP04.phx.gbl... > > "Martin" <ironwoodcanyon(a)gmail.com> skrev i meddelandet > news:jnfvp5lv3ck85trkf94vujm8dkgo6votam(a)4ax.com... >> On Tue, 16 Mar 2010 10:57:40 -0500, Paul Clement >> <UseAdddressAtEndofMessage(a)swspectrum.com> wrote: >> >> >>>� >>> >>>Keep in mind that when you use Seek or FindFirst and there is no match, >>>the pointer in the Recordset >>>is actually in no mans land. Both BOF and EOF will be False. That's why >>>it's a good idea to perform >>>a MoveFirst or Move to a current row in the Recordset when NoMatch is >>>True. >>> >> >> If I do a .Seek and get a .NoMatch then I'm going to be doing either >> an .AddNew or I'm going to be doing nothing further with that >> recordset. So why does it matter where the record pointer is? >> >> An .AddNew is not affected by the status of BOF or EOF is it? >> >> And, if I'm taking no further action with the recordset, then the >> record pointer has no bearing on things does it? >> >> BTW, I'm not trying to argue with anyone here, I'm truly trying to >> understand just how this works. >> > > What happens if you do a MoveFirst before doing the Seek? I'm only using > SQL queries when accessing db's, so I don't know what happens if the Seek > is performed when the last record is the current. > > /Henning I am not sure about what situation you are asking, but one has to check for BOF and EOF before using MoveFirst in case the recordset is empty.
From: Nobody on 16 Mar 2010 17:41
"Paul Clement" <UseAdddressAtEndofMessage(a)swspectrum.com> wrote in message news:21tvp5lha9ckpb75qrsh06dh67gd2v2b5r(a)4ax.com... > On Tue, 16 Mar 2010 10:33:10 -0700, Martin <ironwoodcanyon(a)gmail.com> > wrote: > > > � >Keep in mind that when you use Seek or FindFirst and there is no match, > the pointer in the Recordset > � >is actually in no mans land. Both BOF and EOF will be False. That's why > it's a good idea to perform > � >a MoveFirst or Move to a current row in the Recordset when NoMatch is > True. > � > > � > � If I do a .Seek and get a .NoMatch then I'm going to be doing either > � an .AddNew or I'm going to be doing nothing further with that > � recordset. So why does it matter where the record pointer is? > � > � An .AddNew is not affected by the status of BOF or EOF is it? > � > � And, if I'm taking no further action with the recordset, then the > � record pointer has no bearing on things does it? > � > � BTW, I'm not trying to argue with anyone here, I'm truly trying to > � understand just how this works. > > No problem. After calling AddNew and Update the record pointer is still in > no man's land (e.g. no > current record). > > Like I said, try a MoveFirst or a Move to establish a valid row position > in the Recordset. > > > Paul > ~~~~ > Microsoft MVP (Visual Basic) Incorrect on all counts, how are you still as an MVP anyway? Maybe you should go to the .Nxt group where you belong. After calling AddNew, the new record becomes current. Also, if there was no current record before calling Update, you are most likely to get an error before calling Update when accessing one of the fields, because there is no current record. And you can't do MoveFirst or Move to establish a valid row position if the recordset is empty. |