Results 1 to 13 of 13
  1. #1
    Joseph Cheong is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Jul 2014
    Location
    Singapore
    Posts
    7

    Access formulas


    Hello World,

    I am a newbe here. Need some help. On an Access Query table, so far I am able to do expressions to calculate between fields on the same row. I am wondering if it is possible to do expressions involving cells on the same column but different row. eg =IF (B2 = "ABC",B2,B1) That formula is of course possible on excel but I cant figure out how to do this on access Query Table.

    Kind Regards
    Joseph

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    One way to get the value from the previous row:

    http://allenbrowne.com/subquery-01.html#AnotherRecord
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    razors1968 is offline Novice
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    18
    If I understand you correctly you want to be able to set a value in your current row based on a value in a different row?

    Is this the row previous or do you need to find a specific row based on the value? A little more detail on what you are trying to achieve would be useful, almost all things are possible it is just a matter of defining exactly what.

    Cheers

    Ray

  4. #4
    Joseph Cheong is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Jul 2014
    Location
    Singapore
    Posts
    7
    [IMG]D:\! MRP Detail Report\Formula Example[/IMG]

  5. #5
    Joseph Cheong is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Jul 2014
    Location
    Singapore
    Posts
    7
    0
    A
    B
    C
    Result of the formula in column C
    1 Tango Apple If A1 = Tango, B1, C0
    Apple
    2 T 123 If A2 = Tango, B2, C1
    Apple
    3 T 343143 If A3 = Tango, B3, C2
    Apple
    4 T 34365 If A4 = Tango, B4, C3
    Apple
    5 T L;agl;k If A5 = Tango, B5, C4
    Apple
    6 Tango Zebra If A6 = Tango, B6, C5
    Zebra
    7 Z 2222 If A7 = Tango, B7,C6
    Zebra
    8 Z Uuuuu If A8 = Tango, B8,C7
    Zebra
    9 Z Kkkkk
    If A9 = Tango, B9,C8
    Zebra

  6. #6
    Joseph Cheong is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Jul 2014
    Location
    Singapore
    Posts
    7
    Thats what I want to do

  7. #7
    razors1968 is offline Novice
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    18
    Hi Joseph

    Have a look at using a DLookup() function

    http://msdn.microsoft.com/en-us/libr...ffice.15).aspx

    This function allows you to retrieve information from a specific field from a specific row with a table or query. Expression is the field name, domain is the table or query name, the criteria is like the WHERE condition of a query.

    Let me know if this makes sense for your problem.

    Cheers

    ray

  8. #8
    Joseph Cheong is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Jul 2014
    Location
    Singapore
    Posts
    7
    Hello Ray, I am preatty new at Access and especially DLookup functions. I will give it a go. Thanks for pointing me in the right direction

  9. #9
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,621
    There is no C0 cell in the sample table. Even if there were, I don't see how this can work at all. You are trying to apply spreadsheet functionality to a relational database. Will drive you nuts.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  10. #10
    Joseph Cheong is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Jul 2014
    Location
    Singapore
    Posts
    7
    Hmmmm, How do I DLookup 1 cell above?

  11. #11
    Joseph Cheong is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Jul 2014
    Location
    Singapore
    Posts
    7
    Hmmmm, I am still stuck. How do I DLookup 1 cell above in a query table

  12. #12
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Quote Originally Posted by Joseph Cheong View Post
    Hmmmm, I am still stuck. How do I DLookup 1 cell above in a query table
    Specific to this question
    http://support.microsoft.com/kb/101081

    However, it seems you are not using Access as it is intended. You may benefit from studying Relational Database fundamentals.
    https://www.accessforums.net/tutoria...ase-45451.html

  13. #13
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,621
    Also, review post 9.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Formulas
    By joh344 in forum Queries
    Replies: 33
    Last Post: 04-22-2014, 12:15 PM
  2. Replies: 4
    Last Post: 02-20-2014, 02:40 PM
  3. Replies: 4
    Last Post: 12-17-2012, 01:21 PM
  4. Replies: 1
    Last Post: 08-31-2012, 04:41 AM
  5. Formulas
    By dunnmel4 in forum Access
    Replies: 0
    Last Post: 03-27-2011, 04:59 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