Event for MS Scroll Bar

  • Thread starter Thread starter Dan B
  • Start date Start date
D

Dan B

Hi;

When my user uses the MS Access DB Scroll bar at the
bottom of the form for a new record, I need to add some
code before allowing the blank form to come up. What is
the event for next record on the MS Access Scroll Bar? I
tried the data change event, but it doesn't seem to work.

Thanks,
Dan
 
Dan said:
When my user uses the MS Access DB Scroll bar at the
bottom of the form for a new record, I need to add some
code before allowing the blank form to come up. What is
the event for next record on the MS Access Scroll Bar?


The horizontal scroll bar doesn't have any events, but that
doesn't matter because it can't scroll to a different
record.

I suspect you mean the Navigation Bar that does move you
from one record to another. Unfortunately, that doesn't
have any events either. However, you can use the form's
Current event to check for the new record:

If Me.NewRecord Then
' it's a new record
Else
'it's an existing record
End If
 
Dan B said:
Hi;

When my user uses the MS Access DB Scroll bar at the
bottom of the form for a new record, I need to add some
code before allowing the blank form to come up. What is
the event for next record on the MS Access Scroll Bar? I
tried the data change event, but it doesn't seem to work.

What Scroll Bar are you talking about? I could be wrong, but I think
you are talking about the Navigation Buttons, not the scroll bar. In
either case, there's no event that you can use attached to the control
itself, but there is an event attached to record navigation in the form:
the Current event. This event fires each time a record becomes the
current record.

There is no special "New (Blank) Record Current" event, but you can test
in the Current event to see if the record that has just become current
is the "new record", so you can still put code in there that should only
be executed for a new record. For example:

Private Sub Form_Current()

If Me.NewRecord Then

' put code here that should run only for
' new, unsaved records.

End If

End Sub
 
Back
Top