Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Second subform changes to first

Status
Not open for further replies.

sbell

Programmer
Apr 18, 2002
9
US
I put 2 subforms on an Access 2000 employee form. Both are linked by EmployeeID.

The first is payroll data and the second is phone numbers. When I go in and out of design mode twice the phone number subform becomes a payroll subform and then I have 2 payroll subforms and no phone numbers.

How do I overcome this?
 
How are ya sbell . . . . .

Need to piece this together a little. Things are a bit blurry . . .

For the [blue]MainForm & 2 subForms[/blue], what are the [purple]relationships[/purple] of the underlying respective tables?

Post the pertinent [blue]table & fieldnames![/blue]

Post The [blue]recordsource[/blue] of the forms!

Calvin.gif
See Ya! . . . . . .
 
Recordsources are:
Main form: tblEmployees, pk EmployeeID
Subform1: tblPayroll, pk EmployeeID-WeekEnding-Paytype
Subform2: tblPhones, pk EmployeeID-Phone

Both subforms are linked to the main form by EmployeeID.
 
pk for tblpayroll should be an autonumber for payrollid
same for phones. Each table should have an fk to employeeid.
then forms and subforms should link on employeeid

misscrf

It is never too late to become what you could have been ~ George Eliot
 
sbell said:
[blue]Both subforms are linked to the main form by EmployeeID.[/blue]
Are the tables linked in the same way?

Calvin.gif
See Ya! . . . . . .
 
exactly.

take a moment to look up table normalization. It will not take too long, and you won't regret it. No database will go far if it is not normalized. If you have trouble finding resources ( which you shouldn't) let me know and i will dig up some that I have used in the past.

misscrf

It is never too late to become what you could have been ~ George Eliot
 
misscrf . . . . .
[ol][li][purple]Forms do not have to be linked according to table relationships[/purple]. Same is true for tables in a query!. Remember to link, [blue]the two fields simply require the same data type[/blue] . . . . they can even have different names. So to be sure in this case is premature, particluarly in relation to the problem.[/li]
[li]The driving force for asking if table relationships are the same, stem from the fact that [blue]shell[/blue] has posted [purple]compound primarykeys![/purple]. These types of keys always raise the complexity of the database, and you'll have more problems with them verses single.At your leisure . . . have a look at these types of keys . . .[/li][/ol]

Calvin.gif
See Ya! . . . . . .
 
either way, the discussed nature of the tables is not normalized. That was my point. Sorry I tried to help.

misscrf

It is never too late to become what you could have been ~ George Eliot
 
misscrf . . . . .

I [purple]was not trying to be/sound demeaning in any way[/purple]. [blue]Your help is always welcome[/blueee]. I was just trying to point out that table relationships are not known at this point (espcially with the compound keys), let alone if the tables are normalized!

Lets see if [blue]shell[/blue]comes back. For the moment, we do seem to be talking to ourselves . . .

Calvin.gif
See Ya! . . . . . .
 
lol

misscrf

It is never too late to become what you could have been ~ George Eliot
 
I recently switched to Access after working with Paradox for 12 years and I used compound primary keys a great deal. Nevertheless I will use autonumbers to get the form to behave properly.

My database is normalized. The relationship of employees to subforms/tables is 1-M.

I appreciate your input very much. Thank you!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top