Results 1 to 3 of 3
  1. #1
    huntersoasis is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jun 2015
    Posts
    11

    Calculated Field - Removing "Data"

    First let me describe the issue this database is not "Data normalization" but is required to be this way because of the way it is used in export to a MYSQL site.


    so while data normalization would resolve the issue as far as the problem i have it would not work for the other direction.




    A field in the database is a calculated field. and reads as this.
    Code:
    IIf([PRODUCT_MENU_ORDER]=9,"Out Of Stock",IIf([CATEGORY_1]="","",[CATEGORY_1]) & IIf([CATEGORY_2]="","","|"+[CATEGORY_2]) & IIf([CATEGORY_3]="","","|"+[CATEGORY_3]) & IIf([CATEGORY_4]="","","|"+[CATEGORY_4]) & IIf([CATEGORY_5]="","","|"+[CATEGORY_5]) & IIf([CATEGORY_6]="","","|"+[CATEGORY_6]) & IIf([CATEGORY_7]="","","|"+[CATEGORY_7]) & IIf([CATEGORY_8]="","","|"+[CATEGORY_8]) & IIf([CATEGORY_9]="","","|"+[CATEGORY_9]) & IIf([CATEGORY_10]="","","|"+[CATEGORY_10]) & IIf([CATEGORY_S_BIKINIHOUR]="","","|"+[CATEGORY_S_BIKINIHOUR]))

    The issue that in place is at times there are "Categories" that can not be used while this calculated field takes 10 fields and creates them into one field with a option of another controlling it.


    Can anybody think of a way to limit it to where if a "Category" field has the words "Dress" or "Shirt" it removes it while still completing the calcualation? can it be done in query? get me a idea. I did have a calculation that would work but ran into issue of a "Calculated field" can only have a calculation of 2048 char and the calculation that was written was well over 2048.


    I will give you a idea of the field now.


    CATEGORY_1,CATEGORY_1,CATEGORY_1,CATEGORY_1,CATEGO RY_1,CATEGORY_1,CATEGORY_1,CATEGORY_1,CATEGORY_1,C ATEGORY_1
    Dress,Shirt,Pants,Black,Long,Short,Lace,Top,Bottom ,Skirt,


    and the Calculated Field would produce from the above if


    Code:
     [Product_Menu_Order]

    was not a 9
    CALCATEGORY
    Dress|Shirt|Pants|Black|Long|Short|Lace|Top|Bottom |Skirt


    and what I want to happen is for somehow to remove in the calulated field "Long" and "Bottom" to make it




    Dress|Shirt|Pants|Black|Short|Lace|Top|Skirt




    Thanks for Any input.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,526
    1. if you have to use THAT many IIF then you should think about resorting to building a function.

    2. Your IIF statement makes no sense,
    in IIf([CATEGORY_1]="","",[CATEGORY_1])
    if the value CAT1 = "", then it will show "" , then there is no need at all for the IIF.
    you will get the same result by just showing: [CAT1]
    without the IIF.

  3. #3
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    I have to agree with ranman256, if you can't/won't normalize your database, you will have to use/write a UDF.
    IMO, it would be easier to have a normalized structure and arrange the data to be exported to MySQL, than to fight the problems of a non-normalized structure.

    Allen Browne has a function to concatenate multiple values at http://www.allenbrowne.com/func-concat.html.
    You could/can modify the code to remove "Long" and "Bottom" in the result.

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

Similar Threads

  1. Replies: 4
    Last Post: 09-24-2014, 09:11 AM
  2. Replies: 22
    Last Post: 09-04-2014, 09:12 PM
  3. Replies: 3
    Last Post: 04-22-2013, 06:08 AM
  4. Avoiding "#Error" in Calculated Field
    By Aaron5714 in forum Forms
    Replies: 1
    Last Post: 01-22-2013, 03:43 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