Save Button Code

B

Brian

I am attempting to create a form for entering data and then saving it to a
table.

I have created a form called Project Entry_Fast Track. It's source is a
query called Project Entry_Fast Track. I have added a save button to the
form and have been trying to get the data entered into the form to save into
a table called New Projects Table when I click the save button on the form.
I haven't had any luck. The data just saves back into the query and is
displayed on the form, which I don't want. I want the form to just be a
blank template. I hope this is clear. Thanks for your help!
 
P

PJFry

The first thing to understand is that there is no 'save' feature in access.
Once you leave a field that you have keyed data into, then the data are
saved. Your save button does not do what you think it does.

It sounds like what you want to do is to build this form on the New Projects
table. When you create this form, set the Data Entry property to Yes. This
will give you your blank template.

Try that for starters.

PJ
 
B

Brian

PJ,

So I cannot insert a command button onto the form and have it save the keyed
data to a table?

What I've done is inserted a command button and gone to properties, then
event. At on click I select Code Builder. There is not code that I can
enter to specify a particular table to save data entered into a form?
 
P

PJFry

Brian,

Yes, you can have a button that inserts data into a table, but I don't think
that is what you need. If all of the data you are entering is going into one
table, then you should build your form on a query of that table.

The alternative would be to have an unbound form with unbound controls and a
SQL statement that inserts all of the values into a table. The user would
click the 'save' button to execute the statement. Again, this can be done,
but except for very specialized cases, I don't know why anyone would go
through the effort.

The no-save issue is often a sticking point for Access users who are
accustomed to have to save data in spreadseets.

Let me know if the form works.

PJ
 
M

Mike Painter

Brian said:
PJ,

So I cannot insert a command button onto the form and have it save
the keyed data to a table?

What I've done is inserted a command button and gone to properties,
then event. At on click I select Code Builder. There is not code
that I can enter to specify a particular table to save data entered
into a form?

You build your forms on tables or queries.
Once the information has been entered into a form almost anything you do
will save it in a table or tables.
Move to a subform, move to a new page, close the form, close Access. All the
data is saved.

If you see the same information when you open the form it's because you are
looking at the first record.
Note the navigation buttons at the bottom of the form
 
B

Brian

What I have is a form with a combo or drop down box that displays a list of
project templates. When you make a choice from the drop down box it opens a
template to enter data with predefined numbers for a fast track project,
small size project, medium, etc. The user can add information, edit the
predefined info, etc for his or her specific project. The template is based
off a query. I then want the user to be able to click save project or add
new project and have it save to a "New Projects" table. Right now when Save
is clicked it just saves back to the query used as the template, which
obviously messes up the template the next time a user attempts to enter a new
project.
 
R

Rick Brandt

Brian said:
What I have is a form with a combo or drop down box that displays a
list of project templates. When you make a choice from the drop down
box it opens a template to enter data with predefined numbers for a
fast track project, small size project, medium, etc. The user can
add information, edit the predefined info, etc for his or her
specific project. The template is based off a query. I then want
the user to be able to click save project or add new project and have
it save to a "New Projects" table. Right now when Save is clicked it
just saves back to the query used as the template, which obviously
messes up the template the next time a user attempts to enter a new
project.

This is how a bound form behaves. If you don't want that behaviuor then
don't use a bound form. You need to retrieve the values with code to
populate the form instead of binding the form to the query.
 

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