Add Record with command button?

P

ptlm65

I know this is simple for some but could anyone help?

I have two text boxes and a command button. What would the code be s
that when I click the command button, the data in the two unbound tex
boxes are added to their respective fields in a table?

one text box is txtDateWorked and the other is txtHoursWorked. Th
command button would add the data in both fields to the DateWorke
field and HoursWorked field in the table respectively. Thanks i
advance
 
A

Al Camp

ptlm65,
If you've used your table (or a query based on that table) as the
RecordSource for the form, those values will automatically added to the
table whenever you leave the form, or refresh/update the form. The
individual fields on your form should be bound to their respective table
fields via the ControlSource for each field.

A button with OnClick EventProcedure of...
DoCmd.GoToRecord , , acNewRec
will send you to a new record, and will also update the table with the
values from the record you just left. Navigating from one record to another
constitutes an Update.
 
Top