1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Access Problem

Discussion in 'Business Applications' started by PincivMa, Jan 23, 2006.

Thread Status:
Not open for further replies.
Advertisement
  1. PincivMa

    PincivMa Thread Starter

    Joined:
    Mar 13, 2004
    Messages:
    378
    I have employee names with dependents on an Access form. The form is based on a query. The dependents vary from 0 to 6. I have to put all 6 fields on the form in order to capture all the dependents. Is there a way in Access that I can only have the dependents that a particular employee has. For example, I have an employee called Mark with 2 dependents called Jane and Mary. On the Form I have a field for Jane and one for Mary but I also have 4 other fields that are empty. I do not need these empty fields on the Form.

    I have around 80 employees with different number of dependents. Is there an easy way to not show the empty fields?? Please help.

    Mario
     
  2. cristobal03

    cristobal03

    Joined:
    Aug 5, 2005
    Messages:
    3,086
    You may hide or show textbox controls based on how many dependents are queried per employee, yes. I wouldn't recommend this though--it leads to development maintenance issues. If at some point you wish to expand the dependent capacity per employee, you'd have to add controls to your form.

    I would recommend using a subform in either continuous forms or datasheet view. That way the subform would display only the matching records, and you have no wasted control space. Since the tables seem to be related already, this would be relatively simple using the subform wizard.

    HTH

    chris.
     
  3. OBP

    OBP Temporarily Banned

    Joined:
    Mar 8, 2005
    Messages:
    19,889
    You need an employee table and dependents table. In the dependents table have a field with the same name as the Key field of the employees. In the dependents form have a combo box that lists your employees and stores the empoyee's ID in the new key field of the dependents.
    Then when you list employee's you can list only those with that key field by putting

    forms![Emlpoyee]![keyfield]

    in the criteria row of the new employee key field.

    where [Employee] is the name of your form and [keyfield] is the name of your employee's key field.
     
  4. PincivMa

    PincivMa Thread Starter

    Joined:
    Mar 13, 2004
    Messages:
    378
    Thanks OBP, I'll try and do what you told me to do, since I'm a beginner in using Access. I'm not quite sure exactly what you mean but I do have an Idea.

    Thanks again.

    Mario
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/436600

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice