Page 1 of 2 12 LastLast
Results 1 to 15 of 30
  1. #1
    Huddle is offline Competent Performer
    Windows XP Access 2010 64bit
    Join Date
    Jun 2010
    Posts
    318

    Simplifying expressions by assigning parts to variables error

    I have a report with many unbound fields with expressions (over 200). I've began getting this error message. This may seem like a dumb question but what does it mean when it speaks of simplifying the expression by assigning parts to variables. I put a few examples of some of the expressions below.

    "This expression is typed incorrectly, or it is too complex to be evaluated. For example, a numeric expression may contain too many complicated elements. Try simplifying the expression by assigning parts of the expression to variables."

    =Count(IIf([District]=1,0))
    =Count(IIf([District]=1,IIf([FSL]=4,0)))
    =[D1Final4]+[D1Waiver4]+[D1PreMist4]


    =[D1TotalCom4]/[D1TotalReq4]

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    The IIf are missing the value if condition is false.

    =Count(IIf([District]=1,0,1))

    =Count(IIf([District]=1,IIf([FSL]=4,0,1),0))
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Huddle is offline Competent Performer
    Windows XP Access 2010 64bit
    Join Date
    Jun 2010
    Posts
    318
    The formulas worked on a previous version without the false condition. What changed was a table was split and I had to add a table to the record source which I guess cause an addtional step in the process of analyzing and caused the error. I don't think the false condition makes a difference.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Don't know why it worked. The true and false parts are required arguments.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Huddle is offline Competent Performer
    Windows XP Access 2010 64bit
    Join Date
    Jun 2010
    Posts
    318
    It has something to do with the subform. If I remove the subform the error does not appear. When I try to open the subform alone it gives the error. I cannot attach an example so if anyone have any suggestions on what I should try I'll post my findings once I've solved it.

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Why can't provide example or the db for analysis? Follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    Huddle is offline Competent Performer
    Windows XP Access 2010 64bit
    Join Date
    Jun 2010
    Posts
    318
    Governmental Security Restrictions

  8. #8
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Don't care about real data, just the Access file structure. Dummy records could help with analysis but not essential. Otherwise, good luck.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    Huddle is offline Competent Performer
    Windows XP Access 2010 64bit
    Join Date
    Jun 2010
    Posts
    318
    I was able to get permission to send the attachment. I think I got all the necessary structure moved. The report worked as a whole until I took the commander and inspector out of the building table and put them in their own table. After that I began getting the error and the sub report will not load.
    Attached Files Attached Files

  10. #10
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    First off, I would not use Count, I would use Sum.

    =Sum(IIf([District]=1,IIf([FSL]=4,1,0),0))

    I should have seen that in examples of your first post.

    However, I did experiment with the report structure. I made a copy and then copied all the controls from the subreport to the main report, deleted the subreport container and inserted a page break control. I did get error message about too many fields on report so I deleted the Command section. Report then opened without error. So I made another copy of report and subreport, deleted the Command section from the subreport. The report/subreport arrangement then opens without error. When I restored the Command section and deleted FY, the error returned. So I hope this helps you narrow down source of the error.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  11. #11
    Huddle is offline Competent Performer
    Windows XP Access 2010 64bit
    Join Date
    Jun 2010
    Posts
    318
    I thought I found the field that was causing the error. I got it to work when I put in FY12 but when I put in FY11 it gave the error, which makes no sense at all.

    In regards to Sum vs Count. Should I be replacing all my expressions with Sum rather than Count or just the Total fields.

  12. #12
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    I tested for FY11 with the Command section removed and report runs.

    Where was the correction you made?

    I would use Sum in expressions with IIf. But there are a lot of Counts in this report. If Count actually works, don't change, I just don't think I would have used Count.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  13. #13
    Huddle is offline Competent Performer
    Windows XP Access 2010 64bit
    Join Date
    Jun 2010
    Posts
    318
    By process of elimination I believe it was the Total Required / Unassigned Field. When I changed it to =Count(IIf([Command]="",0)) then the report worked without the error but only when FY12 was selected. The FY selected should not make any difference. I check the queries behind using FY11 and FY12 and they both work fine.

  14. #14
    Huddle is offline Competent Performer
    Windows XP Access 2010 64bit
    Join Date
    Jun 2010
    Posts
    318
    Another thing I noticed. If you run the sub report alone you get different results then you do when you run it with the full report. I have a mess!!!!!!!!!!!!!!

  15. #15
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    What textbox is that calculation in?

    Can't disagree but should be doable.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 06-13-2011, 06:04 PM
  2. Replies: 5
    Last Post: 06-10-2011, 03:31 PM
  3. Simplifying a table
    By jrmvt in forum Database Design
    Replies: 5
    Last Post: 02-18-2011, 11:00 PM
  4. field parts
    By DavidAlan in forum Queries
    Replies: 3
    Last Post: 09-07-2010, 01:36 PM
  5. (simple) Expressions give error message
    By P.Hofman in forum Forms
    Replies: 3
    Last Post: 01-21-2010, 01:57 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