Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding Data to Table via Form

Status
Not open for further replies.

CrystalVis

Technical User
Jun 26, 2002
200
US
hello experts,
i'm creating a simple form for my user to add data to a sql table. on the form i have a combo box that pulls the emp_id from the employee table. i also have 2 text boxes. text box1 displays employee first name and text box2 displays employee lastname. the values in the two text boxes are based on the employee_id i select in the combo box. so once the user selects an emp_id, firstname and lastname will display in the two text boxes. i also have three additional blank text boxes to allow the user to
enter the salary data (current amount, increase amount and increase date). once a user enters the info into the three text boxes, they can click on an ADD button and i want to take the empl_id, current_amount, increase_amount and increase_date and add this new record to a another table called compensation and clear the screen so the user can process the next employee. i'm able to connect a combo box and get the first and last name in the two text boxes from the employee table. i've also bound the form to table compensation. i need to know what code do i need behind the ADD button to add the record to the compensation table and clear the screen so that the user can process the next employee. i'm a newbie to Access so your help and suggestion is greatly appreciated.

Thanks
 
Anyone in the forum can help me with this? thanks
 
One Way:

You have already bound the form to the compensation table.

Set the Data Entry property for your form to yes.
Place bound text boxes on the form for your fields.
Then, when you place the ADD button on the form, use the wizard for the Save Record code. (Record Operations>Save Record)

Following the code written by the wizard, you may have to add a line:
Me.DataEntry = True

This line will clear the boxes and prepare the form for a new entry.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top