close form question

K

KAitchison

Good Morning,

I'm having a little problem with my form and was wondering if someone might
be able to help,

basically you open it and enter data and click submit, when you click submit
it enters a recordset into a table and clears out the entry boxes (except for
one that is not visable and defaulted to a specific value)...from here you
can enter the next record set or close if your finished.... if you click the
close form button at this point it closes the form but creates a blank
record... (or if you have something typed it will save that as well)

is there a way to stop it from saving anydata back to the table when you
click close.. the only time i want something back to the table is when you
click the submit button....

Thank you so much,
Krista
 
K

KAitchison

A little observation to add to this..

If you go to the table when you create a new record the last record has an
recordID, which is an autonumber... so what is happening is this:

Last Record ID = 100
You go to form, enter the data, submit record it creates records with ID's
starting at 103
Then when you click 'close form' it inserts a blank record into recordID = 102
 
K

Klatuu

A couple of things worth noting.

As to "submitting" records. It is done for you automatically. It is not
necessary or even advisable to try what you are doing. As you are seeing,
you are fighting against the power of Access. A better idea is to provide
the user with an Undo button that will discard any changes to the current
record. Trust me on this. Ten years ago I fought the same battle.

As to the autonumbering, that is because once an autonumber is assigned, it
is not used again even if you don't save the record. But, it should not
matter. Autonumber fields should never be used for meaningful data nor
should users ever see them. They are intended only to be used as Surrogate
keys and for linking Parent Child relationships.
 
K

KAitchison

i must admit that i am extremely confused now....

are you telling me to program close button so that it adds to the record set
and closes the closes the form??

that wont really work as some times you may need to make multiple entries...
and you would be having to re open the form each time...

as for the auto numbering i dont really care about that... its haivng a
blank record created everytime the form is closed that i dont want... and it
doesn't do this for any other forms but this one when they are all desgined
with the same thing in mind.. you fill in the forms, submit, and repeat until
you are done then you close the form... the fxn of the close button should be
only to close the form.... i am sooooo confused...
 
K

Klatuu

No, that is not at all what I am saying. What I am saying is you are
creating a new record so the controls will be empty. Then if you close the
form without undoing the form, you have a blank record in the table. If undo
the update or delete the record, you have a gap in your autonumber.
 
K

KAitchison

why do you need to undo a completly blank form?? I dont think i understand
what is happening to create a blank record.. it doesn't make sense that
access does that does it?.. and why dont I need to do this for my other forms
which are built the same way??... you dont need to answer but i'm still a bit
confused...

thank you for suggesting the undo option
 
K

Klatuu

You have to be doing something different in this form.
The way Access forms work is that when you open a bound form, the first
record in the form's record source is presented. Each time you move to a
different record, the record being displayed in the form updates the datbase
if any changes were made. The only ways to show a form with no records are:

1. The form's table or query has no records
2. It is an unbound form
3. You go to a new record. When you do that, a new record is created and if
you have an autonumber field, it is populated. And, as I stated previously,
the assigned number will not be used again.

If you enter no data in the form, it will update the record with no data
unless there are field level validation rules in place. To avoid saving a
blank record, you have to Undo the form before you move to a new record.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top