Simple question - inserting record in table from form

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

Guest

I am a new user to MS Access and I am asking for help in regards to a form I
am creating.

I simply want to know how to add a record to a table upon the click of a
button on a form. I am confused as to how to link text boxes and combo boxes
on the form with specific fields in a table so it can insert a new record.

If someone could get me going in the right direction i would appreciate it.
 
You can use the Form wizard to set up your form for you. Create a new form
using the wizard and tell the wizard that you want to base your form on a
table. Follow its directions from there.

--

Ken Snell
<MS ACCESS MVP>

Ty said:
I am a new user to MS Access and I am asking for help in regards to a form I
am creating.

I simply want to know how to add a record to a table upon the click of a
button on a form. I am confused as to how to link text boxes and combo boxes
on the form with specific fields in a table so it can insert a new record.

If someone could get me going in the right direction i would appreciate
it.
 
I am a new user to MS Access and I am asking for help in regards to a form I
am creating.

I simply want to know how to add a record to a table upon the click of a
button on a form. I am confused as to how to link text boxes and combo boxes
on the form with specific fields in a table so it can insert a new record.

If someone could get me going in the right direction i would appreciate it.

You don't even need to click a button.

A Form inserts records, all on its own - or edits existing records,
whichever you want to do.

The Form has a "Record Source" property, which is the name of the
table or (more commonly) of a Query based on the table.

Each textbox, combo box, or other control has a "Control Source"
property which is the name of the field that the control will update.

The Forms Wizard will walk you through the process of setting up such
a form; just select the table in design view and click the AutoForm
button. Or (maybe better) create a new Form and step through the
process of adding controls from the list of fields, so you have a
clear feel for how it all works.

John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 
OK.. I'm still a little confused. I have a form that contains text boxes,
combo boxes, and radio buttons that should all be filled in on the form (some
should auto-populate depending on the values of other fields, but we'll get
to that later).

The form is a method to track overtime hours. I have an employees table and
a positions table where I need to grab info from and another table that I
want to insert new records into. In one text box, for example, the last name
of the employee should be entered. Do I need to relate this text box to the
employees --> last name field? So the user enters the employees name, I want
that person's ID number to automatically appear in another text box.

Then, I want the user to be able to enter a value in an overtime hours text
box, where a simple number is inputted. There are also three radio buttons
for the three different shifts, so depending on the radio button pushed, that
value is inserted into the "watch" field of our table. There are also drop
down menus thats we assosiated with three different radio buttons, "Housing",
"Booking", and "Control". How do we make it so only one radio button can be
clicked? After that radio button is clicked that section is entered into the
table and only those values from the related drop down are selected and
inserted into the "position" field in the table

Can you get me started? I would appreciate any help.
 
OK.. I'm still a little confused. I have a form that contains text boxes,
combo boxes, and radio buttons that should all be filled in on the form (some
should auto-populate depending on the values of other fields, but we'll get
to that later).

The form is a method to track overtime hours. I have an employees table and
a positions table where I need to grab info from and another table that I
want to insert new records into. In one text box, for example, the last name
of the employee should be entered. Do I need to relate this text box to the
employees --> last name field? So the user enters the employees name, I want
that person's ID number to automatically appear in another text box.

This is where Combo Boxes are handy. If you have a combo box which has
the EmployeeID as its Control Source and its Bound Column, but which
*shows* the employee name (the combo wizard will help you set this
up), you can store the ID in the overtime-hours table.

The employee's name should NOT be stored in the overtime-hours table
at all! It should exist only in the Employee table. If the ID is an
autonumber or other meaningless ID, it is best not to display it on
the screen at all. If you have Employee ID's which are meainingful and
used, you can *display* both the ID and the name on a form - but
again, the name should only be displayed, not stored. To do so, use a
Combo Box with the ID and the name; and set the control source of a
textbox to

=comboboxname.Column(n)

where (n) is the *zero based* position of the field you want to show.
Then, I want the user to be able to enter a value in an overtime hours text
box, where a simple number is inputted. There are also three radio buttons
for the three different shifts, so depending on the radio button pushed, that
value is inserted into the "watch" field of our table. There are also drop
down menus thats we assosiated with three different radio buttons, "Housing",
"Booking", and "Control". How do we make it so only one radio button can be
clicked? After that radio button is clicked that section is entered into the
table and only those values from the related drop down are selected and
inserted into the "position" field in the table

Put the radio buttons in an Option Group control. The Watch field
should have numeric values; you can set the Option Group so that the
value stored will depend on which button was clicked. I do not
understand what you mean by "drop down menus... associated with three
different radio buttons". Why two controls to do one task?
Can you get me started? I would appreciate any help.

It *sounds* like you've made a quite common mistake: starting your
design with the Form. A Form is just a tool, a window for entering
data into tables. It's important to get the table design right first,
and only then start working on the form.

John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 
Back
Top