Full Version: Enter data into Form, save data to Table
UtterAccess Forums > Microsoft® Access > Access Forms
umpapa
Been trawling web for a while, cannot find answer to what is seemingly a common occurence
wish to have the data that is entered in a form, saved to a Table.
More specifically, everytime all the fields in a form are filled, it would save this as another row of data in the Table.
pere_de_chipstick
welcome2UA.gif
ormally in MS Access your form is bound to a table and each of your controls are bound to the fields in that table.
Access automatically saves the data to the bound table when you move, from the record you are entering or editing, to another record.
HTH
umpapa
Thanks for the reply.
henever I enter data on the form, it does indeed save it to the table. however when I close and open the form, and start entering data again, instead of using the next row on the table it replaces the data entered in the first row. how could I resolve this issue
missinglinq
Use tihs code
!--c1-->
CODE
Private Sub Form_Load()
DoCmd.GoToRecord , , acNewRec
End Sub
pere_de_chipstick
Hi umpapa

When you open a form in access then normally it will open at the first record, and unless the underlying table has no records, then, yes, entering data into those controls will overwrite the existing record.

You need to ensure that you are at a new record before you enter data, this you can do in several ways.
1. Use the navigation buttons at the bottom of the form and click the '>*' This will take you to a new blank record which will show blank fields (unless you have default values set)

2. Put a command button on the form with the code 'DoCmd.GoToRecord , , acNewRec'
(You can use the button wizard to create the code for you)
This basically does the same as 1. above and can be used on say pop up forms when you don't want to show the navigation buttons

3. Set up the form as a Data Entry form.
On the FORM's properties menu set the 'Data Entry' property on the Data Tab to 'Yes'
Each time you open it, the form will open to a new record.
Note: the form in Data Entry mode will show ALL the records you have added since you opened the form, After you have added a record, you have to ensue that you are at the new record position to add further records. Once you close the form, and reopen it the form will not show records added in a previous session.

It may also help, if your controls can be arranged in a horizontal row, to set the form's 'Default View' property (on the Forms properties format tab) to 'Continous Forms'. In this case you will see all the records from the underlying table and the new record is the very last record on the form.

HTH
Edited by: pere_de_chipstick on Tue Jun 2 9:25:04 EDT 2009.
umpapa
I have some Number Fields on the Table
uring data entry, sometimes these do not need to be filled in
How do I make it so Access makes it a Blank cell, instead of a '0', as the default value
missinglinq
Go into Design View for the underlying table, click on the field in question, then go down to the Default Value and delete the Zero. Repeat tis for all fields you want without a Default Value then save the table.
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.