Results 1 to 9 of 9
  1. #1
    Join Date
    Feb 2006
    Posts
    14

    Unanswered: Link information

    I have a table with an Employee ID field and a Employee Class field along with some other fields. The Employee ID always has the same Class association. I want to be able to have the Class information automatically entered into the table once I enter the Employee ID in my form. Whats the best way?

    Thanks,

    Met

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    define "enter the Employee ID in my form". Is this a new employee? Existing employee? Are you entering into a combo box? If so what is it's source? Are you using something else if this is indeed a lookup form?
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  3. #3
    Join Date
    Feb 2006
    Posts
    14
    I manually enter this ID. Example: Jack has an ID of 5 and
    I enter that. And Jack is always a Class C. I want the class C entered into my table without having to manually add it since it is C for 5. Or F for 8, depending on the employee.

    Thanks,
    Met

  4. #4
    Join Date
    Feb 2006
    Posts
    14

    Closer, any help?

    Ok, I am using the following code:

    Private Sub CLASS_Enter()

    If [EMPLOYEE ID] = "8" Then [CLASS] = "C"
    If [EMPLOYEE ID] = "12" Then [CLASS] = "C"
    If [EMPLOYEE ID] = "18" Then [CLASS] = "C"
    If [EMPLOYEE ID] = "20" Then [CLASS] = "C"
    If [EMPLOYEE ID] = "27" Then [CLASS] = "C"
    If [EMPLOYEE ID] = "4" Then [CLASS] = "F"
    If [EMPLOYEE ID] = "5" Then [CLASS] = "F"
    If [EMPLOYEE ID] = "24" Then [CLASS] = "F"
    If [EMPLOYEE ID] = "25" Then [CLASS] = "F"
    If [EMPLOYEE ID] = "33" Then [CLASS] = "F"
    If [EMPLOYEE ID] = "34" Then [CLASS] = "F"
    If [EMPLOYEE ID] = "35" Then [CLASS] = "F"
    If [EMPLOYEE ID] = "36" Then [CLASS] = "F"
    If [EMPLOYEE ID] = "27" Then [CLASS] = "F"
    If [EMPLOYEE ID] = "14" Then [CLASS] = "M"
    If [EMPLOYEE ID] = "32" Then [CLASS] = "F"

    End Sub

    It enters the value in the form but it will not update my table and if I set the table to require the input, it treats the
    entered data as zero..

    Any help???

    Thanks,

    Met

  5. #5
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    shift the class to be an attribute of the employee table. Solving the problem in the manner you do at present is going to be a maintenance nightmare, any change of employee requires a change to the db.
    I'd rather be riding on the Tiger 800 or the Norton

  6. #6
    Join Date
    Feb 2006
    Posts
    14

    Been there done that.

    Class is already an attribute of the employee table. It just
    does not seem to accept the data properly. It displays it
    in my form but treats it as a null value. Any advice?

    Thanks,
    Met

  7. #7
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    You don't need any VBA to do this, from what I can tell so far.

    Start over, what has been your process thus far, what tables are you working with, what structures do they have, what are you importing, what structure does the imported data have?
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  8. #8
    Join Date
    Feb 2006
    Posts
    14

    Suggestions, welcome.

    I am not the sharpest tack when it comes to access. I am
    probably looking at this at a completely wierd angle. I have a simple table that has 5 fields. Of those fields, one
    is an employee ID number and one of the five is the class
    field. From there I have created a simple form to input the
    data for my table. I enter the employee ID in the form and I would like to have the class field auto-populated (instead of key'ed entry). The employee ID is always a given class. IE: Employee ID 8 always has a class of C. How can I populate my table by just entering an 8 in my
    form?

    Thanks,
    Met

  9. #9
    Join Date
    Feb 2006
    Posts
    14

    When in doubt, start over again.

    Ok, the previous code works fine. Somehow my database
    got corrupted so I started over from a previous save and it worked fine from there. However, I did decide to use Sendkeys instead of just asigning a value. "It was easier
    to send a return that way"

    Thanks,
    Met

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •