How to insert a record when I click a button ?

  • Thread starter Thread starter John
  • Start date Start date
J

John

Maybe this question is very easy for an experienced MS Access developer.

But now, I need to do the following things :

When a user click a command button, the "Click" Event will insert a new
record to a table.
How can I write the source code for it ?

Thanks a lot.
 
John said:
Maybe this question is very easy for an experienced MS Access
developer.

But now, I need to do the following things :

When a user click a command button, the "Click" Event will insert a
new record to a table.
How can I write the source code for it ?

Thanks a lot.

Where is the data for the record coming from? Normally one would execute an
append query to do this, but an append query has to either SELECT data from
another table or query to insert or it needs to have a VALUES list that it uses.
The data has to come from somewhere.
 
Hi
Not a good idea to insert new record directly to a table! Use a form to
insert the record.
Use the command button wizard in Design Mode for the form to create button
which will add a new record.

HTH

John
 
But I have to do that because I need to do some day-end calculation jobs and
these jobs will insert some records into my day-end tables, so, I have to
write a function which can insert or update a table's records.

How can I do that ?
 
Create a form based on the table you want to add records to.
A form is only a way to show a more graphical interface and neater layout
rather than table view.
Everthing you do to a record in the form is related to the table.
When you create a form, by default "Record Selectors" (Add, Next,
Previous,etc) will be shown at the bottom of the form.
Another point is you can show all the calculations on a form using text
boxes but not in a table.

Regards

John
 
Back
Top