Data entry form changing the table data

  • Thread starter Thread starter Martin Osborne
  • Start date Start date
M

Martin Osborne

Hello All,

A small problem (I hope) for all you genius's to solve. :-)

I use a data entry form to record employee data.

When I quit the form the employee's name in the first row of data in the
table gets changed to whichever name I was on when I closed the form.

What is causing this and how do I stop it?

Thanks in advance for any help you can give,

Martin
 
Hello All,

A small problem (I hope) for all you genius's to solve. :-)

I use a data entry form to record employee data.

When I quit the form the employee's name in the first row of data in the
table gets changed to whichever name I was on when I closed the form.

What is causing this and how do I stop it?

Thanks in advance for any help you can give,

Martin

It sounds like you have the Form editing the first record of the
table. What is the Recordsource property of the form? What is the
Control Source of the employee name control on the form? Are you using
code in this control to find an employee's record?

John W. Vinson[MVP]
 
Hello John,

Many thanks for picking up on this.

I am not using any code in this form setup.

To perhaps give you a clearer picture of the situation: for data entry there
is a main and sub (datasheet) form. On the main form I use a combo box to
select the employees name (linked to the employeeId field on the
employeeRecord table which is a lookup from the employeeId on the main
employee table) and a series of text boxes to enter the rest of the data. On
the sub form I show the records (from table employeeRecords) I already have
for this person (to avoid duplication and give a visual picture of the
recent past). The data is then recorded in the table 'employeeRecord'.

What seems to happen is that, say I'm recording data for Ted Smith. I select
Ted and enter the data and close the form. When I open the employeeRecord
table the name in the very first record has now been changed to Ted's name.
The rest of the data in the first record is fine and the new record I
entered for him is there correctly as the last entry at the bottom of the
table.

Thinking about this again, have I just created some kind of loop? I had the
name field on the datasheet sub (but not showing) and I have just deleted
that and retried to enter data and so far so good. Can you leave this with
me for a while and we'll see if I've somehow hit on the fix.

Isn't experimentation wonderful!

Thanks again,

Martin
 
Hello John,

Many thanks for picking up on this.

I am not using any code in this form setup.

To perhaps give you a clearer picture of the situation: for data entry there
is a main and sub (datasheet) form. On the main form I use a combo box to
select the employees name (linked to the employeeId field on the
employeeRecord table which is a lookup from the employeeId on the main
employee table) and a series of text boxes to enter the rest of the data. On
the sub form I show the records (from table employeeRecords) I already have
for this person (to avoid duplication and give a visual picture of the
recent past). The data is then recorded in the table 'employeeRecord'.

What seems to happen is that, say I'm recording data for Ted Smith. I select
Ted and enter the data and close the form. When I open the employeeRecord
table the name in the very first record has now been changed to Ted's name.
The rest of the data in the first record is fine and the new record I
entered for him is there correctly as the last entry at the bottom of the
table.

Open the mainform in design view.

Select this combo box.

Change its Control Source from the EmployeeID to nothing at all - just
blank out the control source property.

What's happening is that you are opening the form (to the first record
in the table by default), picking a name from the combo box - AND
STORING THAT VALUE into the currently active record, the first one.

If you're using a combo box to *find* records that combo box *must* be
unbound - nothing in its Control Source.

John W. Vinson[MVP]
 
Back
Top