Reset button on bound form

  • Thread starter Thread starter Chris
  • Start date Start date
C

Chris

I'm using a form with bound controls. when a value is entered into one of
the bound controls, an autonumber is generated. I would like to have a
reset button/ delete button.

I also have subforms that need the primary key on the main form before they
can save there details. These forms are unbound.

What should I do?
 
Hi Chris,

Hide the autonumber. It's doing good work for you but neither you nor
anyone else should see it. To see it is to believe you own it and should
control it - you shouldn't.

You already have a record selector unlessyou chose not to show them. To
delet a record, click the record selector (the vertical column on the left
of your form) and hit the delete key. For a more elegant solution (as you
asked) Create a command button to delete the current record. With the
wizards [Wand and stars] on enabled on the toolbar create a command button
where you want it on your form. The wizard steps you through.

If the subforms need the PK of the main form before you can enter data, they
are bound in some way. In the subform control on the main form view the
properties and see what you have in Link Master Field and Link Child Field.
They should both have something that equates to the PK of the main form's
record. Usually the subform is based on a query based on a child table.
I.e. Mainform is products, subform is ingredients.

What you should do is read the Hitchhiker's Guide to the Galaxy. It answers
the global questions like "What is the meaning of life and everything"?

HTH
 
A couple of other points:

There is also an Undo function that you can use on a form: Me.Undo

Once the autonumber is generated it is not returned to the pool. If you
cancel or delete the record after the autonumber is generated it is simply
not used. First reason why you don't want to see what an autonumber happens
to be. It exists strictly for the purpose of creating a surrogate key. If
you actually need to generate and manage a sequence, you have to do it
yourself.

By the way, you'll find info on autonumber and all kinds of Access lore at
www.mvps.org/access

HTH
 
Back
Top