Still having problems... 
Author Message
 Still having problems...

I have code in a module that I run from an On_Click event of a command
button.  The code needs to check to see if the current record displayed in
the form is the first or the last in the recordset.

I've tried:

        form_object.RecordsetClone.BOF() and EOF()

but they never return true, even when the should.  What am I doing wrong?



Fri, 10 Sep 1999 03:00:00 GMT  
 Still having problems...

Christopher,

If your form is on a "current" row, then you are neither BOF or EOF; you
are just on a row.  You need to use MovePrevious and MoveNext appropriately
to see if they return BOF or EOF to really know if you were on the first or
last rows of the recordset.

   Phil



Quote:

> I have code in a module that I run from an On_Click event of a command
> button.  The code needs to check to see if the current record displayed
in
> the form is the first or the last in the recordset.

> I've tried:

>    form_object.RecordsetClone.BOF() and EOF()

> but they never return true, even when the should.  What am I doing wrong?



Fri, 10 Sep 1999 03:00:00 GMT  
 Still having problems...

You have to synchronise your position in the clone, with your position on
the form, using the bookmark property.

Only then will you be at the "same" position.

BTW, if you are at a new record, you cannot obtain a bookmark  - a
trappable error will occur (therefore in fact this is one way of testing to
see if you are at a new record).

HTH

--
Steve Sarre
SIS
London UK



Sat, 18 Sep 1999 03:00:00 GMT  
 Still having problems...

This is a multi-part message in MIME format.

------=_NextPart_000_01BC3F48.D345E660
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

Hi everyone,

It seems my original reply to this post got trashed, so here it is again
FWIW.

Cheers!
Graham
--------------------------------------------------------------

Hi Christopher

As Phil points out, neither .BOF nor .EOF will be true until a
MovePrevious/.MoveNext has been performed.

However, you should also be aware that the RecordsetClone does not
necessarily have the same current record as the form, so you need to
synchronise them first, using the Bookmark properties of both.  Also, you
may need to account for the case where you are on a new record, where the
form's bookmark will be invalid.

The following routine is not much practical use, but it does demonstrate
techniques for checking all three cases:

Private Sub Form_Current()
If Me.NewRecord Then
  MsgBox "New record"
Else
  With Me.RecordsetClone
    .Bookmark = Me.Bookmark
    .MovePrevious
    If .BOF Then MsgBox "First record"
    .Bookmark = Me.Bookmark
    .MoveNext
    If ...EOF Then MsgBox "Last record"
  End With
End If
End Sub

(I'm assuming V7 or later)

Hope this solves the problems...
--
Graham Mandeno
Alpha Solutions Limited
Auckland, New Zealand



Quote:

> I have code in a module that I run from an On_Click event of a command
> button.  The code needs to check to see if the current record displayed
in
> the form is the first or the last in the recordset.

> I've tried:

>    form_object.RecordsetClone.BOF() and EOF()

> but they never return true, even when the should.  What am I doing wrong?

------=_NextPart_000_01BC3F48.D345E660
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<html><head></head><BODY bgcolor=3D"#FFFFFF"><p><font size=3D2 =
color=3D"#000000" face=3D"Arial">Hi everyone,<br><br>It seems my =
original reply to this post got trashed, so here it is again =
FWIW.<br><br>Cheers!<br>Graham<br>---------------------------------------=
----------------------- <br><br>Hi Christopher<br><br>As Phil points =
out, neither .BOF nor .EOF will be true until a .MovePrevious/.MoveNext =
has been performed.<br><br>However, you should also be aware that the =
RecordsetClone does not necessarily have the same current record as the =
form, so you need to synchronise them first, using the Bookmark =
properties of both. &nbsp;Also, you may need to account for the case =
where you are on a new record, where the form's bookmark will be =
invalid.<br><br>The following routine is not much practical use, but it =
does demonstrate techniques for checking all three cases:<br><br>Private =
Sub Form_Current()<br>If Me.NewRecord Then<br> &nbsp;MsgBox &quot;New =
record&quot;<br>Else<br> &nbsp;With Me.RecordsetClone<br> =
&nbsp;&nbsp;&nbsp;.Bookmark =3D Me.Bookmark<br> =
&nbsp;&nbsp;&nbsp;.MovePrevious<br> &nbsp;&nbsp;&nbsp;If .BOF Then =
MsgBox &quot;First record&quot;<br> &nbsp;&nbsp;&nbsp;.Bookmark =3D =
Me.Bookmark<br> &nbsp;&nbsp;&nbsp;.MoveNext<br> &nbsp;&nbsp;&nbsp;If =
...EOF Then MsgBox &quot;Last record&quot;<br> &nbsp;End With<br>End =
If<br>End Sub<br><br>(I'm assuming V7 or later)<br><br>Hope this solves =
the problems...<br>-- <br>Graham Mandeno<br>Alpha Solutions =
Limited<br>Auckland, New Zealand<br><br><br>Christopher G. Carnahan =

color=3D"#000000">&gt; wrote in article &lt;<font =

color=3D"#000000">&gt;...<br>&gt; &#009;<br>&gt; I have code in a module =
that I run from an On_Click event of a command<br>&gt; button. &nbsp;The =
code needs to check to see if the current record displayed in<br>&gt; =
the form is the first or the last in the recordset.<br>&gt; <br>&gt; =
I've tried:<br>&gt; <br>&gt; &#009;form_object.RecordsetClone.BOF() and =
EOF()<br>&gt; <br>&gt; but they never return true, even when the should. =
&nbsp;What am I doing wrong?<br>&gt; <br><br></p>
</font></font></font></font></font></body></html>
------=_NextPart_000_01BC3F48.D345E660--



Sat, 18 Sep 1999 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Looking for tool to make AVI files from JPG stills

2. Creating time-lapse AVI movie from SNAPPY stills?

3. create fog on a stills picture

4. Pulling PC Cam stills with an API

5. Having some problems with ObjectNames(newbie)

6. Problem starting Acces 97 after having started Outlook 2000

7. Having problems with VBA332.dll

8. Having problems with sorting character or text fields

9. Having problems with locating date values

10. I'm having a problem with a date variable

11. Still having problems with my filters

12. New user having problems and would appreciate any help

 

 
Powered by phpBB® Forum Software