bof-eof

  • Thread starter Thread starter Simon
  • Start date Start date
S

Simon

hi,
My problem is that, how can i know if the user moves the focus thorough a
form to the eof or the bof of the current file ?

Thanking you in advance.
 
You can check the Me.Recordset.EOF and Me.Recordset.BOF properties via VBA
code in the form's VBA code module.
 
Simon said:
hi,
My problem is that, how can i know if the user moves the focus thorough a
form to the eof or the bof of the current file ?

I'm not sure I follow you. A form will not let you position its recordset
to the BOF or EOF position. You're either on the new record, in which case
the form's NewRecord property is True, or you're on an existing record, in
which case the NewRecord property is False. Aside from that, it's possible
to determine if you're on the form's first record (Me.CurrentRecord = 1)
and, with a bit more difficulty, whether you're on the last (but not new)
record:

Dim strWhichRec As String

If Me.NewRecord Then
strWhichRec = "new"
ElseIf Me.CurrentRecord = 1 Then
strWhichRec = "first"
Else
With Me.RecordsetClone
.MoveLast
If Me.CurrentRecord = .RecordCount Then
strWhichRec = "last"
Else
strWhichRec = "middle (" & Me.CurrentRecord & ")"
End If
End With
End If

MsgBox "We're on the " & strWhichRec & " record."
 
hi,
My problem is that, how can i know if the user moves the focus thorough a
form to the eof or the bof of the current file ?

Thanking you in advance.

Jargon: Access tables aren't "files".

You can use the form's Current event to check Me.Recordset.AbsolutePosition;
it will be 1 if the user is at the first record, and equal to
Me.Recordset.RecordCount if it's at the end. You'll probably want to check
Me.NewRecord as well.
 
John W. Vinson said:
You can use the form's Current event to check
Me.Recordset.AbsolutePosition;
it will be 1 if the user is at the first record,

I believe it will be 0, not 1.
and equal to
Me.Recordset.RecordCount if it's at the end.

..RecordCount - 1; see above. But I think, given the asynchonous loading of
the recordset, you can't rely on this to be true. I could be wrong about
that, though.
 
My problem is that, how can i know if the user moves the focus
thorough a form to the eof or the bof of the current file ?

In a bound form, the user can't.

Why would you be caring about something that a bound Access form
takes care of for you?
 
Because the Access does not display the appropiate message (such as "You are
already in the first record...." etc.).

Ο χÏήστης "David W. Fenton" έγγÏαψε:
 
Ο χÏήστης "David W. Fenton" έγγÏαψε:


Because the Access does not display the appropiate message (such
as "You are already in the first record...." etc.).

Your comments make no sense without further explanation. Clearly you
must be using non-standard navigation methods rather than the
built-in Access controls, or you would not be having such problems.

What are you trying to accomplish?
 
Back
Top