display a formula in a query field

Posted on 2011-05-04
Last Modified: 2012-06-21

i would like to display a formula in my field, kind of like what excel shows in the formula field, but i want it to be displayed in a query field.

So let say i have in excel:
=25000 - 17 - 600

i want to show this in my query:

25000 - 17 - 600

my field names that hold these values are: soldfor - fedex - crating

Question by:lucas911
    LVL 75

    Expert Comment

    by:DatabaseMX (Joe Anderson - Access MVP)

    SELECT Table1.FIELD1, Table1.FIELD2, Table1.FIELD3, Nz([soldfor],0)-Nz([fedex],0)-nz([crating],0) AS MyFormula
    FROM Table1;

    LVL 12

    Accepted Solution

    = [soldfor] & " - " & [fedex] & " - " & [crating]

    LVL 13

    Author Closing Comment

    That's what i was looking for.
    LVL 75

    Expert Comment

    by:DatabaseMX (Joe Anderson - Access MVP)
    "but i want it to be displayed in a query field."
    The answer you Accepted does *not* work in a Query field, which is clearly what you stated, and why I posted as such.  The answer you accepted only works as an Expression in a Text box on a Form.

    And if you are not wanting to do the Math, then you would use this:

    SELECT Table1.FIELD1, Table1.FIELD2, Table1.FIELD3, [soldfor] & "-" & [fedex] & "-" & [crating] AS MyFormula
    FROM Table1;


    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Join & Write a Comment

    Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
    In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now