Results 1 to 8 of 8

Thread: Easy One

  1. #1
    Join Date
    Jul 2003
    Posts
    41

    Unanswered: Easy One

    Good day,

    I have an employee table with 700 records. The employee table has a primary key, Employee ID. If I make changes to the position field in this table, I want to "update" these changes to my vacation table. The vacation table also has the Employee ID field.
    I.E. If employee 1001 gets promoted to "Manager", if I made the change to the position field in the employee table, can I run an update query to update the vacation table IF the employee has any record(s) in the vacation.
    Make sense?

    Thanks for any help

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713

    Re: Easy One

    Originally posted by justlearning200
    Good day,

    I have an employee table with 700 records. The employee table has a primary key, Employee ID. If I make changes to the position field in this table, I want to "update" these changes to my vacation table. The vacation table also has the Employee ID field.
    I.E. If employee 1001 gets promoted to "Manager", if I made the change to the position field in the employee table, can I run an update query to update the vacation table IF the employee has any record(s) in the vacation.
    Make sense?

    Thanks for any help
    Yes. Or you could use the relationship to cascade updates ...

  3. #3
    Join Date
    Jul 2003
    Posts
    41
    Hey,

    I thought cascade updates was only good when you change your primary key. The field I want to update is the position field?

  4. #4
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Originally posted by justlearning200
    Hey,

    I thought cascade updates was only good when you change your primary key. The field I want to update is the position field?
    It might if the column in question was indexed. In this case I'd just write a small SQL query to perform the update ...

  5. #5
    Join Date
    Jul 2003
    Posts
    41
    Hey M Owen,

    Unfortunately the field is not indexed. I created an update query and I am getting key violations. Any ideas?

    Thanks

  6. #6
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Originally posted by justlearning200
    Hey M Owen,

    Unfortunately the field is not indexed. I created an update query and I am getting key violations. Any ideas?

    Thanks
    Let's see your query ...

  7. #7
    Join Date
    Jul 2003
    Posts
    41
    Hey M Owen,

    I had some syntax issues but I have it working now. Here is what the query looks like:

    UPDATE tblemployee INNER JOIN tblvacation ON tblemployee.empid = tblvacation.empid SET tblvacation.curtour = [tblemployee]![curtour], tblvacation.curpos = [tblemployee]![curpos];



    Thank you

  8. #8
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Originally posted by justlearning200
    Hey M Owen,

    I had some syntax issues but I have it working now. Here is what the query looks like:

    UPDATE tblemployee INNER JOIN tblvacation ON tblemployee.empid = tblvacation.empid SET tblvacation.curtour = [tblemployee]![curtour], tblvacation.curpos = [tblemployee]![curpos];



    Thank you
    It definitely does help to eliminate those ...

Posting Permissions

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