Results 1 to 2 of 2
  1. #1
    kosan is offline Novice
    Windows 7 Access 2007
    Join Date
    Sep 2010
    Posts
    1

    How to update fields automatically

    Good Moring,



    I have a table named serviceCall that has a many-to-many relationship with a table named employee through a table named employeeServiceCall that stores the employeeId and the serviceCallId both combined comprise the primary key of the intermediary table employeeServiceCall.

    I have 2 questions,

    first,

    When a user uses the form frmServiceCall to insert or update a service call how can I retrieve the amount of employees involved in that specific record as a number and store it in a field named amountOfEmployees located in the serviceCall table in order to use it for future processing?

    second,

    When a user uses the above form to insert a new record, how can increment by 1 the number field named amountOfCalls located in the table named customer?

    FYI the customer table is joined with the serviceCall table through the customerId field.

    Thank you for your help!
    Kostas

  2. #2
    HiTechCoach's Avatar
    HiTechCoach is offline MS MVP - Access Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Jul 2010
    Location
    Oklahoma, USA
    Posts
    702
    Kostas,

    Welcome!

    Quote Originally Posted by kosan View Post
    I have a table named serviceCall that has a many-to-many relationship with a table named employee through a table named employeeServiceCall that stores the employeeId and the serviceCallId both combined comprise the primary key of the intermediary table employeeServiceCall.

    I have 2 questions,

    first,

    When a user uses the form frmServiceCall to insert or update a service call how can I retrieve the amount of employees involved in that specific record as a number and store it in a field named amountOfEmployees located in the serviceCall table in order to use it for future processing?
    You don't.

    You should NOT store calculated values that as based on the data. You perform the calculation as need to get the value. This way it is always accurate.

    I would use a totaling query to get the count. This query can be added to any other query to get the value you want.



    Quote Originally Posted by kosan View Post
    second,

    When a user uses the above form to insert a new record, how can increment by 1 the number field named amountOfCalls located in the table named customer?
    You don't.

    You should NOT store calculated values that as based on the data. You perform the calculation as need to get the value. This way it is always accurate.

    I would use a totaling query to get the count. This query can be added to any other query to get the value you want.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 08-20-2010, 06:40 AM
  2. Automatically update datasheet
    By tammiep in forum Forms
    Replies: 1
    Last Post: 08-17-2010, 04:43 PM
  3. Automatically Lock Fields
    By Toolman in forum Database Design
    Replies: 2
    Last Post: 05-27-2010, 10:36 AM
  4. Help Automatically running and Update Query
    By JohnRandolphSTL in forum Queries
    Replies: 8
    Last Post: 04-13-2010, 02:08 PM
  5. Replies: 4
    Last Post: 05-19-2009, 04:15 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums