Add new record to table without overwriting existing record

  • Thread starter Sharda via AccessMonster.com
  • Start date
S

Sharda via AccessMonster.com

Hi all,
I have started to work with ms acess for like a week now. so have pretty much
very limited know how in ms access programming. and I'm stuck with this
problem for soemtime now..

I am trying to add a new record to a table and here is what I have so far:

I have one table that has 3 columns in it and a autonumber which is the
primary key.
I have a form that has query1 as RecordSource. The query1 is simple Select of
all columns from the table.
the form has a combo box, a text box for column1, textbox for column2,
textbox for column3.
i have a 'New record' button on the form to add a new record to the table.
the wizard-generated code is:

DoCmd.GoToRecord , , acNewRec
I fill in the values in the textboxes and click on the 'New Record' button.
but this is overwriting the very first record in the table.

I looked at several posts on the web for a solution, but couldn't get this to
work.
I really need some help with this!!!!
TIA
 
M

Marshall Barton

Sharda said:
I have started to work with ms acess for like a week now. so have pretty much
very limited know how in ms access programming. and I'm stuck with this
problem for soemtime now..

I am trying to add a new record to a table and here is what I have so far:

I have one table that has 3 columns in it and a autonumber which is the
primary key.
I have a form that has query1 as RecordSource. The query1 is simple Select of
all columns from the table.
the form has a combo box, a text box for column1, textbox for column2,
textbox for column3.
i have a 'New record' button on the form to add a new record to the table.
the wizard-generated code is:

DoCmd.GoToRecord , , acNewRec
I fill in the values in the textboxes and click on the 'New Record' button.
but this is overwriting the very first record in the table.


You have to click the button BEFORE you enter the data.

The new record should be blank or display only the
DefaulValues before you enter the new record's data.
 
E

Evi

Do you actually want the button to save your record so that you can enter a
new one? You don't normally need this in a form based on a query.

If your form is based on a simple select query then the New Record button
does exactly the same as pressing the * button after the record number in
the Navigation Button at the bottom of your form. Are you pressing it before
you have actually finished entering the record?

If you really are using the button in exactly the same way as pressing the *
button, then are you sure that it is overwriting your first record (have you
checked in the table itself)?
i'm just wondering if you have Data Entry form (in Design View look at its
Properties and see if it says Yes next to Data Entry. Change this to No).
Data Entry means that it always shows a blank form ready to input data - an
unnerving thing. You can do this just as well with a normal form. You can
use a different type of code to make sure that it always moves to the last
record when it opens)
Evi




Evi
 
L

Linq Adams via AccessMonster.com

Marsh answered the question yesterday> The OP simply has to click on the New
Record button first, then enter data! You can't change an existing record in
Access and then press "New Record" and expect Access to save the old,
altered record as a new record.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top