Check for next record.

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

Dan B Again

I asked this before a couple of months ago, but since
then I got a virus and actually had to reformat my hard
drive (OUCH)! Anyway, it's been a couple of months since
I've been able to get out here and check for an answer.

I have a "add" button on my form that will add another
record to a database. In the "click" event of that form
I check for a maximum number of records (three records).
The code works well and I can keep someone from adding
the fourth record until I want them to.

PROBLEM: There is a MS scroll bar at the bottom of the
form. My user could potentially use the scroll bar to go
to the fourth record (bypassing my code). Is there
an "event" procedure for the scroll bar's next record?
Is there another event I should look for?

Thanks,
Dan
 
Dan,

"There is a MS scroll bar at the bottom of the form" do you mean the
navigation buttons (one record forward / back, first, last, new)? This can
be removed permanently from the form (in design view, form properties,
Format tab, Navigation buttons > No), or it can even be handled
programatically (visible set to True or False through code at runtime).

Just to give you some ideas, in case this is what you are looking for: I
have a form which by default is "read-only"; all controils are disabled,
allow additions is disabled, navigation buttons are visible (without the add
new button). The form has an Edit, an Add New and a Save button (plus an
Exit one).
When user clicks on Edit, controls become enabled, form is locked in the
current record by applying a filter, navigation buttons are invisible.
When user clicks Add New (custom button, not the one in navigation), form is
set to data entry > Yes, controls enabled, navigation buttons invisible.
When user clicks Save, changes are saved and initial "read-only" state is
restored.

Note: all of this does not prevent a user with a wheel mouse from scrolling
into a new record while in "add new" state! To deal with this I have used
the on got focus event of all controls (but the PK) to perform a goto
previous record if PK control is null. Anybody got a better idea, welcome!

HTH,
Nikos
 
Back
Top