Results 1 to 3 of 3
  1. #1
    nygiantsfan is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2014
    Posts
    3

    Unique expression under same field name

    Hi all,



    I am trying to create a field in which each row has it's own unique expression for calculation. For example I want a field titled utility; however, John's equation for utility is different from Mary's calculation. I want Access to calculate both of these utilities under the same field (column) entitled utility utilizing a given equation that manipulates other fields within the table. Any help would be very much appreciated . Hope you all had a great weekend!

    -nygiantsfan

  2. #2
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Welcome!

    I would recommend creating a User Defined Function. You can pass in the user name as one of the variables, and have it calculate differently for them.
    See here for User Defined Functions: http://www.fontstuff.com/vba/vbatut04.htm

    I would probably use Case statements for each different user/calculation (http://www.techonthenet.com/access/f...anced/case.php), i.e.
    Code:
    Select Case UserName
        Case "John"
            ' Do John's calculation here
        Case "Mary"
            ' Do Mary's calculation here
        ...
        Case Else
            ....
    End Select

  3. #3
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,441
    You could also define the calculation you want to perform per employee in a table and use that to do the calculation, just substituting in values from your table into the formula.

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

Similar Threads

  1. Can I make a calculated text field unique?
    By alexandervj in forum Access
    Replies: 3
    Last Post: 03-21-2014, 09:17 AM
  2. Replies: 22
    Last Post: 03-03-2013, 02:00 PM
  3. 2 Records of unique field name
    By tonydepo in forum Queries
    Replies: 5
    Last Post: 03-20-2012, 11:40 AM
  4. Exception in unique field
    By neo651 in forum Access
    Replies: 2
    Last Post: 07-01-2011, 02:23 PM
  5. Restoring a lost field with a Unique Identifier
    By DBinazeski in forum Access
    Replies: 5
    Last Post: 12-20-2010, 08:02 AM

Tags for this Thread

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