PDA

View Full Version : Solved: Display collections of fields in a form based on a selection?



Gingertrees
11-13-2009, 05:38 AM
I'm much better at Excel than Access, so forgive the simple question...
I'm recording information about employees at different companies. I'd like to create a form in which, for a certain company, I can input the number of employees, and then have only a certain number of fields appear.

For example, if I choose number of employees = 2, I want to see the fields
Employee1Name
Employee1email
Employee1phone

Employee2Name
Employee2email
Employee2phone

But I don't need to see the fields for Employee3, Employee10, etc. Remember, this is not to show existing data; this is to show fields in which data will be inputted.

CreganTur
11-13-2009, 11:02 AM
If each employee is a record, then you could use the SQL Top function in a query to pull the top x records- just make sure you create your Order By correctly so it shows the records you want.

HTH:thumb

Gingertrees
11-13-2009, 04:15 PM
Maybe I'm trying to make this too simple, but all the employee information are all separate fields under the record of the Company Name. So,
record 1:INITECH Company has
Employee1name: John Smith
Employee1phone: 555-1212
Employee1email: some@email.com
Employee2name: Jane Doe
Employee2phone: 111-2222
Employee2email: any@emailaddr.com

record 2: Dilbert Company has
Employee1name: John Doe
Employee1phone: 555-1111
Employee1email: 123@email.com
Employee2name: Juan Valdez
Employee2phone: 333-3333
Employee2email: coffee@growers.net

The table literally has 600 fields in it. Obviously I don't want all 600 to show, since a lot are going to go unused for most records. I think I need to create a subform to choose the number of employees, but then I'm having a hard time figuring out how to make just the fields I want appear for filling in.

orange
11-14-2009, 07:30 AM
Maybe I'm trying to make this too simple, but all the employee information are all separate fields under the record of the Company Name. So,
record 1:INITECH Company has
Employee1name: John Smith
Employee1phone: 555-1212
Employee1email: some@email.com
Employee2name: Jane Doe
Employee2phone: 111-2222
Employee2email: any@emailaddr.com

record 2: Dilbert Company has
Employee1name: John Doe
Employee1phone: 555-1111
Employee1email: 123@email.com
Employee2name: Juan Valdez
Employee2phone: 333-3333
Employee2email: coffee@growers.net

The table literally has 600 fields in it. Obviously I don't want all 600 to show, since a lot are going to go unused for most records. I think I need to create a subform to choose the number of employees, but then I'm having a hard time figuring out how to make just the fields I want appear for filling in.

From an Access or database view, your data is not normalized. You have repeating data in the records.
Here is a reference to Normalization (text and videos) that should help:

http://www.allenbrowne.com/casu-22.html

Good luck.

Gingertrees
11-14-2009, 08:05 AM
Whoops! Back to the drawing board...
Thanks for the tip, Orange. :-)