Forms main and sub saving data on dif lines

S

Steve_A

I have a form that contains sub forms on tabs and everything is linked by
EmplyeeID. The one with problems is the staffing sub form.

The main form has the “EmployeeIDâ€, “EmployeeNameâ€, “Buildingâ€, “Floorâ€,
and “Columnâ€, these come from a query on the “Staffing†table. Now there is
a “Staffing†sub form that contains the rest of the employee information
(skills, assigned, director, mgr) that is also using the same query to pass
data to the same table.

All of the fields will take input and when they click the “Save Recordâ€
button on the main form it saves the data BUT the data from the main part of
the form is written to one line in the table and the data from the sub form
is on a second line. If we just fill out the 5 fields on the main part of
the form and then click save then fill out the sub form it does the same
thing. On the other hand if we fill out the main form fields the back off of
the new record and go back to it and fill out the sub form it works like
intended.

I take it that I have problems using the same query for both the main form
and sub form?

If I have made this as clear a mud please ask and I will try again

Thanks
 
J

John W. Vinson

I have a form that contains sub forms on tabs and everything is linked by
EmplyeeID. The one with problems is the staffing sub form.

The main form has the “EmployeeID”, “EmployeeName”, “Building”, “Floor”,
and “Column”, these come from a query on the “Staffing” table. Now there is
a “Staffing” sub form that contains the rest of the employee information
(skills, assigned, director, mgr) that is also using the same query to pass
data to the same table.

All of the fields will take input and when they click the “Save Record”
button on the main form it saves the data BUT the data from the main part of
the form is written to one line in the table and the data from the sub form
is on a second line. If we just fill out the 5 fields on the main part of
the form and then click save then fill out the sub form it does the same
thing. On the other hand if we fill out the main form fields the back off of
the new record and go back to it and fill out the sub form it works like
intended.

I take it that I have problems using the same query for both the main form
and sub form?

If I have made this as clear a mud please ask and I will try again

Thanks

Why are you using a form and a subform for the same table, much less the same
record!?

A Subform is usually used to enter data into a *second table*, related one to
many to the mainform's table - not to edit additional fields in the same
table. Just use all of the fields on the same form, using a Tab Control if you
need more screen space.

Note that if one employee can have multiple skills, you probably *do* need a
second table. There may be some other employee information in the same
category - if you have fields Skill1, Skill2, Skill3 or any other repeating
groups of fields, you need to normalize your table structure.

John W. Vinson [MVP]
 
S

Steve_A

Thanks John, I thought it might be something like that. The reason for
splitting the staffing forms between the main form an a sub form was to have
the employee basic information shown at the top of the form no matter what
tab you were on.

Thanks again
 
J

John W. Vinson

Thanks John, I thought it might be something like that. The reason for
splitting the staffing forms between the main form an a sub form was to have
the employee basic information shown at the top of the form no matter what
tab you were on.

Ok, no problem; just have the tab control not filling the entire form.

John W. Vinson [MVP]
 

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