Results 1 to 2 of 2
  1. #1
    Rosadocc is offline Novice
    Windows 8 Access 2007
    Join Date
    Jun 2015
    Posts
    5

    Ideas On Simplifying Constantly Used If Function


    Hello All,

    I am new to this forum and look forward to being a active and contributing member.

    I hope someone can help me with a question I have regarding IF functions. I will be querying a database that will have two fields that will constantly require multiple IF functions when running the query. For example, one field will constantly require this expression:

    If FIELD_1 in database_A is ABC, it will return "Letters"
    If FIELD_1 in database_A is 123, it will return "Numbers"

    Field: IIf(([database_A]![FIELD_1]="ABC"),"Letters", IIf(([database_A]![FIELD_1]="123"),"Numbers")))

    I plan on having about 20 saved automated queries that will require such function in that field and on occasion, the parameters in the IF functions in that field may need to be tweaked throughout the year, such as If FIELD_1 is ABC, it will now return "TEXT" instead of "Letters".

    My main question here is,
    is there a simplified way of only making changes to the parameters once, instead of having to go into each of the 20 saved queries and going into the expression in Builder for each query and making the changes?

    I apologize in advance for my inexperience in Access but any ideas or help would be greatly appreciated.

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Often times I will use VBA to manage variables. If you feel the need for many saved query objects or the need to edit queries on the fly, this may be an indicator of a data structure that is not normalized. Have you looked into the rules of Normalization? What is the DB being used for? The first steps of putting together your DB should be identifying the Entities and Business Rules.

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

Similar Threads

  1. Replies: 2
    Last Post: 07-03-2014, 08:45 AM
  2. constantly needs focus
    By Dazza666 in forum Programming
    Replies: 4
    Last Post: 08-06-2013, 07:53 PM
  3. Simplifying this code
    By vickan240sx in forum Access
    Replies: 8
    Last Post: 06-06-2012, 06:03 PM
  4. Subforms constantly refresh
    By DarkWolff in forum Forms
    Replies: 3
    Last Post: 02-28-2012, 02:53 PM
  5. Simplifying a table
    By jrmvt in forum Database Design
    Replies: 5
    Last Post: 02-18-2011, 11:00 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