Adding a new Record

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

Guest

Dear All,

I have data entry form developed in Access. This data entry form is bound to
a database table. This data entry form has some textfields and a submit
button.
What I want to do is that when I press submit button. The record from the
text boxes should be inserted into the database. Also I have 1 field which
remain constant. Basically I am adding multiple records against 1 ID field
which is read only text. The text in rest of the text boxes should change as
soon as I press Add new Record Button.
Any help would be greatly appreciated.

cheers,
Sam Solomon
 
Dear All,

I have data entry form developed in Access. This data entry form is bound
to
a database table. This data entry form has some textfields and a submit
button.
What I want to do is that when I press submit button. The record from the
text boxes should be inserted into the database.

You can use one line of code behind the button.

me.Refresh

However, some point out it is better to use

if me.Dirty = true then
me.Dirty = false
end if

Either way, the above will write the data to the table.

I should note that saving is automatic if you close the form, or move to
another record.

When a user tries to move to another record, do you want to ask them if they
want to move?, or, do you want to ask them to save first? If they don't
save, do you want to still move to the other record? This whole mess can get
very confusing very quickly. My bets are that you will have users
complaining that their data was not saved. Likely the best solution is to
just have the system automatically save when you move to a new record.
FoxPro, ms-access, 4th dimension, dbase IV, FileMaker, Alpha..and a zillion
more systems in the last 20 years ALL AUTOMATICALLY save for you, and likely
you should not even bother writing any code here...

However, as the above shows, you can write the data to a table with one line
of code....
 
Back
Top