Hide a bottom bar of a form

  • Thread starter Thread starter Kimmy
  • Start date Start date
K

Kimmy

Hi,

How can I hide the bar at the bottom of the form where we
can go the first, last, or certain record number or even
add a record? The reason is I cannot do validation for
adding a record.

In my form, I have made an Add button of my own and set up
all default values once user click this button. However,
the Add option of this bar causes me to much problem
because I do not have any control in there.

Thanks for your help

Kimmy
 
You can get rid of those buttons by setting the form's Navigation Buttons
property to no.

However, the more important issue is how to validate the form so you don't
need to do that. It's dead easy: use the BeforeUpdate event of the form.
That is the *only* way you can run your validation code before the record is
saved, because there are so many things that trigger the saving of the
record. Examples:
- closing the form (title bar,toolbar, File menu, Alt+F4, or closing
Access);
- pressing Shift+Enter;
- choose Save Record from the Records menu;
- filtering the form (toolbar, menu, or right-click);
- changing the sort order of the form;
- any code that requeries, recalcs, or explicitly saves;
- ...

This example shows how to block the record being saved if the EndDate is
less than the StartDate:

Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.EndDate < Me.StartDate Then
Cancel = True
MsgBox "EndDate must be after StartDate."
End If
End Sub
 
Is there any event that tell me that the record is
in "ADD" mode. In addition, I do not use macro in my form,
by when I do right click, I got error msg that "cannot
find macro "yes"".
Sorry, I am new to Access.
I need help. Thanks.
 
If the form is opened in Add mode, its DataEntry property will be true.

If the form is at a new record, its NewRecord property will be true.

1. Open the form in design view.
2. Open the Properties box (View menu).
3. Make sure that the Title of the Properties box says "Form", so you are
looking at the properties of the form (not those of a text box).
4. Select the Event tab of the Properties box.
5. See if you entered Yes beside any of these properties.
 
Back
Top