Form/Subform with tab control problem (1 Viewer)

aalrr

New member
Local time
Today, 04:59
Joined
Mar 27, 2009
Messages
8
I simplied a form to isolate the problem. The main form (EMP table as recordsource) uses 2 fields from EMP. The subform (also EMP table as r/s) has a tab control with 1 field from EMP table (using multiple tab controls for organization).

When I add a record from the main form (bypassing subform), a record is added to EMP table. If fill out both main and subform parts, I get: "The changes you requested on the table were not successful because they would create duplicate values in the index, primary key, or relationship..."

It apears the subform, doesn't know a new record has been created in the main form. If I leave new record after completing the main form and then return, I can fill out the subform and it saves the data to the new record. Just can't fill them out simultaneously.

The master/child links on the subform appear correct. Interestingly, I added the linked field (Login) to the subform. As I add a new user on the main form the Login populates in the subform field, but the error still occurs (EMP table does not show the record until after I leave the main form).

Thanks.
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 11:59
Joined
Jul 9, 2003
Messages
16,245
You don't need the subform for entering the data, just have the fields you want to enter the data in displayed on the main form.
 

aalrr

New member
Local time
Today, 04:59
Joined
Mar 27, 2009
Messages
8
I dramatically simplified this form to find where the problem was. I need the tab controls because on the final Main form, I will have tabs for HR, IT, Accounting, Billing, and then subtabs for the Departments. I believe using subforms is the only way to layer tab controls.
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 11:59
Joined
Jul 9, 2003
Messages
16,245
>>>I believe using subforms is the only way to layer tab controls.<<<

I think you meant to say that using subforms on tabs is the only way to layer controls on the form, however you do not need to use subforms, you can place fields from the table behind the mainform directly on to tab controls.
 

boblarson

Smeghead
Local time
Today, 04:59
Joined
Jan 12, 2001
Messages
32,059
If you really have the same table being updated by different forms/subforms at the same time, I question whether the design of the database is correct. Can you elaborate further on your design, the table structure, and why you might be trying to put data into the same table(s) from multiple places on the form.
 

aalrr

New member
Local time
Today, 04:59
Joined
Mar 27, 2009
Messages
8
I think I understand what you are saying; however, I will be using a tab control on the main form. Then on each tab page, I will have another set of tab controls. Those tab controls will need to be on a subform because they will be displaying various datasheets from other related tables (computers, phones, attorneys), such as, computers assigned to the user, available computers in the office, phones assigned, available phone lines, attorneys assigned to secretary. I have the form already created. It displays all 200 users in the database correctly. The problem I have is when I try to add a new employee.
 

aalrr

New member
Local time
Today, 04:59
Joined
Mar 27, 2009
Messages
8
I am attaching a doctored database so you can see the look I would like to accomplish. The form frmMain will use all tables that are attached. It has Departmental tabs (i.e. HR, IT) and then more tabs on each of the Department tabs (i.e. IT: Computers and IT: Telecommunications).

I isolated the problem on the frmMain_0. It uses only 1 table, 4 fields and one subform with tabs. Trying to add new record using Main and subform, returns: "the changes you requested to the table were not successful because they would created duplicate values in the index, primary key or relationship..."

Thank you for your responses.
 

aalrr

New member
Local time
Today, 04:59
Joined
Mar 27, 2009
Messages
8
Sorry did not notice that attachment did not make it to the last post.
 

Attachments

  • form tab problem_032609.zip
    410.8 KB · Views: 83

Users who are viewing this thread

Top Bottom