Results 1 to 4 of 4
  1. #1
    icmc is offline Novice
    Windows 10 Access 2016
    Join Date
    Apr 2020
    Posts
    1

    How to build an Expression Builder for a Form


    Hi all

    I am building a Form in access and we have fields where there are calculations. I need to be able to change the calculations in the front end by the user. How can this be achieved?
    Is there something like the expression builder for a Form? User is unable to get to the coding and building part of Access.

    Thx
    Ian

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    build it in a query, then copy it to the form

  3. #3
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,399
    there is an expression builder in form design, at least for text boxes. In properties, go to the data tab and click on the 3 dot caret on the controlsource property

    I need to be able to change the calculations in the front end by the user.
    Do you mean you want the user to create the calculation?

    you would have to build it yourself and potentially could be quite complex or just not possible depending on the nature of the calculation. The user would have to know the names of the fields and controls and follow strict maths rules to create a string.
    You would use the Eval function to evaluate the calculation. for example

    Eval("(10^2)/5")

    would return 20

  4. #4
    kd2017 is offline Well, I tried at least.
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    1,142
    To add to Ajax's comment it might be a good idea to validate/sanitize the user input before sending through the eval function so nothing bad happens.

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

Similar Threads

  1. Replies: 1
    Last Post: 05-15-2018, 09:46 AM
  2. Replies: 3
    Last Post: 05-12-2018, 06:59 PM
  3. Replies: 3
    Last Post: 01-12-2018, 11:54 AM
  4. Replies: 4
    Last Post: 05-03-2016, 01:51 PM
  5. Replies: 2
    Last Post: 11-20-2012, 03:21 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