New to making forms. General questions

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have never made forms before, so I'm sort of teaching it to myself. Problem
is, I am having trouble understanding how to get them to properly work the
way I want them to. What I am trying to do is to create a form that will
allow people to enter information. I want this information to automatically
go into the specified table, BUT I only want it to do so if the person enters
all the information and saves the record. I've been able to point forms
toward a table, but I notice it puts information right into the table whether
or not the person saves. I want them to be able to close out of the form
without saving and thereby have the information the entered NOT go in the
table.

Also, does anybody know how to do form validation? For the form they'd be
filling out, there are several fields that HAVE to be filled out. Is there a
way to make a popup message come up if they do not fill in any required
fields? Sorry if these questions are really elementary, but I'm new to forms
and would appreciate any help you may be able to provide.
 
Paul said:
I have never made forms before, so I'm sort of teaching it to myself.
Problem is, I am having trouble understanding how to get them to
properly work the way I want them to. What I am trying to do is to
create a form that will allow people to enter information. I want
this information to automatically go into the specified table, BUT I
only want it to do so if the person enters all the information and
saves the record. I've been able to point forms toward a table, but I
notice it puts information right into the table whether or not the
person saves. I want them to be able to close out of the form without
saving and thereby have the information the entered NOT go in the
table.

Also, does anybody know how to do form validation? For the form
they'd be filling out, there are several fields that HAVE to be
filled out. Is there a way to make a popup message come up if they do
not fill in any required fields? Sorry if these questions are really
elementary, but I'm new to forms and would appreciate any help you
may be able to provide.

For the first point I would recommend working *with* Access and how it is
designed to function instead of some pre-conception of how you think it
should work. There are millions of Access apps out there in place doing
just fine with the automatic saving that Access uses.

If your users are complete idiots and need this sort of hand-holding you can
use code in the BeforeUpdate event to confirm that they want to save and
cancel the automatic save if they say "No". To not even have a save
attempted unless a button is pressed you would need to use unbound forms (in
which case there is little reason to use Access).

For required fields it is best to make them "Required" in the table design
and then all of this is handled for you automatically.
 
If the user must supply a value:
1. Open your table in design view.
2. Select the field.
3. In the lower pane, set the Required property to Yes.
Then Access won't let the user save the entry unless all the required fields
have a value entered.

Beyond that, use the BeforeUpdate event procedure of the form to perform
record-level validation. It is the event that is fired just before the
record is written. If you cancel the event, the record will not be written.
 
Hey, thanks! This helps out. I've been toying around and now have a few new
questions. I'll understand if people don't want to answer since these are
probably quite elementary, but I'm still trying to figure these ones out.
First, every time I open the form, it keeps automatically populating my
fields with whatever was in the most recent row entered in the table instead
of being blank so people can enter new information. What am I doing wrong?

Also, any way to have them be able to click on a button to save the data
they entered, then automatically go back to a blank form? However, the table
does have several required fields, and if the user is not intending to fill
out another form, I want them to be able to quit without being told they have
to enter data because the form thinks they are trying to add another record.
Will Access do this? Again, my apologies if my questions are all beginner
stuff, but I am a beginner with forms and am having trouble for now.
 
Cool! Thanks. See my response to the other poster. Any help you can give
would be greatly appreciated.
 
Paul said:
Hey, thanks! This helps out. I've been toying around and now have a
few new questions. I'll understand if people don't want to answer
since these are probably quite elementary, but I'm still trying to
figure these ones out. First, every time I open the form, it keeps
automatically populating my fields with whatever was in the most
recent row entered in the table instead of being blank so people can
enter new information. What am I doing wrong?

Set the DataEntry property of the form to Yes and it will open on a new
blank record .
Also, any way to have them be able to click on a button to save the
data they entered, then automatically go back to a blank form?

Me.Dirty = False
Me.DataEntry = True
However, the table does have several required fields, and if the user
is not intending to fill out another form, I want them to be able to
quit without being told they have to enter data because the form
thinks they are trying to add another record. Will Access do this?

If they start a record and change their moind just have them press <Escape>
twice. All entries will be cancelled.
 
Thanks again! I'm glad I stumbled upon this discussion group. Everybody has
been a big help. I only hope I can someday help new folks with their
questions.
 
Back
Top