Results 1 to 6 of 6
  1. #1
    akrylik is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2012
    Posts
    47

    Field Automation Coding


    I have a database in which we are trying to have a field "Headcount" automatically fill with the correct value based on information in multiple fields. The "Headcount" field will be based on about 6 or 7 rules. Most of the rules i can figure out, but im having trouble figuring out what the best way would be to search for a single individual's projects when they are on more than one project at a time. i thought about using a counter of sorts to count how many projects someone was one, but how to i pick them out of the entire table once i have found out the number of projects? Would a for loop work best or just many if statements? I guess my biggest problem is finding out how to determine if someone is on one or many projects.

  2. #2
    John_G is offline VIP
    Windows XP Access 2003
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Hi -

    It sounds very much as if your data is not properly structured - i.e. is not properly normalized. If the projects an individual is on are all listed in one record, then it is not normalized. Can you show us your table structure?

    John

  3. #3
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    Part of the answer probably depends on the structure of your database. Do you have a table in which Projects and People are related.
    For example,

    Project X involves Jim, Tom, Jason, Sarah and Fred.
    Project Y involves Tom, Sam
    Can you post a jpg of your Tables and relationships?


    OOOps. Looks like John was posting while I was typing.

  4. #4
    akrylik is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2012
    Posts
    47
    I did a bad job explaining it. I will get a sample database together here shortly. The idea is to track employee's jobs and if they are working on more than one job, then only one would be counted in a headcount calculation. for now, i think i will focus on getting a counter working. im new to VBA coding, so how would i set up a for loop to search through a table and count how many records have the same last name?

  5. #5
    John_G is offline VIP
    Windows XP Access 2003
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Hi -

    You can do that without VBA - all you need is a totals query with Group By on the last name. But that could be an issue - what do you do if two or more employees have the same last name? You should use group by on a field that uniquely identifies the employees.

    John

  6. #6
    akrylik is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2012
    Posts
    47
    Ight ill give it a try. i will get a sample db up tomorrow or friday. Sorry its taken so long to get it up here.

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

Similar Threads

  1. Please help with VB coding
    By winterh in forum Import/Export Data
    Replies: 11
    Last Post: 03-19-2012, 06:05 PM
  2. Need help in VBA coding
    By Kcgp in forum Programming
    Replies: 6
    Last Post: 02-01-2012, 11:22 PM
  3. Query Field Fill-In Automation
    By dmaach in forum Queries
    Replies: 1
    Last Post: 07-30-2010, 09:21 PM
  4. simple math coding for form field??
    By RCBNewbee in forum Programming
    Replies: 7
    Last Post: 07-13-2009, 08:30 AM
  5. Bar-Coding
    By texasprincess7 in forum Access
    Replies: 1
    Last Post: 02-12-2009, 10:29 AM

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