Results 1 to 6 of 6
  1. #1
    Cyclone_Rob is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Jan 2017
    Posts
    2

    Use specific value from a table in multiple calculations/Excel Name Manager Equivalent in Access

    Hi,

    I'm fairly inexperienced in Access. I'm in the process of converting a series of very complicated Excel spreadsheet to an Access database. In that spreadsheet there are a list of ~20 constants that are used to determine how much of a given material will be used. For example, one constant is the weight of ink per square inch. The spreadsheet uses other inputs (area of paper being printed, % of the paper being covered) to calculate a weight of ink for one printing. For simplicity, using the Name Manager functionality, the constant is named "Ink" and can be used throughout the workbook for calculations by typing "Ink" into the formula. And because it is a referenced cell, if I need to change the value of the constant, I can with one click and the value will be updated in all calculations.

    I want the same functionality in Access. This constant will be used in about a dozen queries so if the value ever changes and I use the "hard" number, I will have to comb back through all of the queries to update it (or more likely, someone else less computer literate will need to update it so I need a user friendly way to manage these constants).

    I tried putting the ~20 constants in a table (named Constants) with column 1 being a 1-word description of each constant named Description, and column 2 is the numerical value and the column is titled K-value. Using this, I tried to pull values in using dlookup("K-value","Constants","Description="&"Ink") in the query expression builder but it did not work. Changed the syntax as well, so it was DLookUp([Constants]![K Value],[Constants],[Constants]![Description]="Ink") but then when I run the query/open it in spreadsheet view I get prompted for each of the values in Dlookup.

    I like the idea of keeping the constants in a table as it will be user friendly to update the values. Does Access have anything I can use to simulate the name manager functionality in Excel?

    Any ideas?

    Thanks in advance.

  2. #2
    Cyclone_Rob is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Jan 2017
    Posts
    2
    Nevermind. I rotated my table 90 degress (instead of 2 columns and ~20 rows, I now have ~20 columns and just one row with each column labelled the specfic type of constant). I can now use the expression builder to pull each column (and since there's only one row) it pulls in the correct piece of information.

  3. #3
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,471
    x = dlookup("K-value","Constants","Description= 'Ink'")

    last part is (single quote)ink(single quote)(double quote)

  4. #4
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,426
    On the basis the constants is effectively configuration data (i.e. you are not adding new constants), either way is doable. In your case the single row is probably the easier to manage. FYI, the syntax for the dlookup is wrong. Assuming it is in a query, it would be

    DLookUp("[K Value]","[Constants]","[Description]='Ink'")

  5. #5
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,471
    My test worked without the brackets on table or query.

  6. #6
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,426
    it probably will, I was using the second example where there is a space in K Value, so brackets required. And description is a reserved word, so better to use the brackets than not.

    Edit - the '-' in the field name is also not advised - coding may try to subtract 'Value' (also a reserved word) from 'K' and fail, using square brackets goes some way to preventing this from happening, but I have known cases where it has not.
    Last edited by CJ_London; 01-18-2017 at 10:45 AM. Reason: further note

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

Similar Threads

  1. Replies: 4
    Last Post: 09-19-2016, 05:02 PM
  2. Excel MATCH formula and Access Equivalent
    By maeyks in forum Access
    Replies: 4
    Last Post: 03-14-2016, 05:31 AM
  3. Replies: 1
    Last Post: 09-30-2012, 07:03 AM
  4. Replies: 10
    Last Post: 08-29-2012, 06:45 AM
  5. Replies: 11
    Last Post: 07-28-2012, 03:55 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