Results 1 to 11 of 11
  1. #1
    New Lounger
    Join Date
    Apr 2004
    Location
    Reston, Virginia, USA
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    IIF() possibly causing database to crash (Access 2002)

    <img src=/S/help.gif border=0 alt=help width=23 height=15>
    This one's a doozy. I'm working on a database and getting a serious error that keeps causing the database to crash. I have two queries in this database (these two queries are the whole reason the database was created), and both use IIF() statements. The queries are also fairly deeply embedded, using two or three other queries to calculate values beforehand. The first time I created & ran these queries, they worked fine. Now if I try to run, modify or even open the queries in Design view, the database crashes & Access closes completely, but leave the *.ldb file open. Does anyone have any thoughts as to why this might be? I can provide more details, if necessary. If anyone has any thoughts, comments, etc., I would greatly appreciate the help. I'm going insane trying to get this one finished! <img src=/S/hairout.gif border=0 alt=hairout width=31 height=23>
    Thank you!
    Stacy

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: IIF() possibly causing database to crash (Access 2002)

    Welcome to Woody's Lounge!

    1. Can you open the queries in design view after a Compact and Repair of the database?
    2. Can you open the queries in design view after importing all database objects into a blank new database?

    If not, could you provide more details about the design of the queries?

  3. #3
    New Lounger
    Join Date
    Apr 2004
    Location
    Reston, Virginia, USA
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: IIF() possibly causing database to crash (Access 2002)

    Thank you for the welcome!
    To answer your questions:
    1. No, I have Compacted & Repaired several times & this has not made a difference
    2. I tried to export everything to a new database today and the new database still crashed when I tried to run the queries.
    Okay, here's a breakdown of the database:
    The main table is a project information table. Amoung other bits of data, there is a win percentage. I then created a couple of other tables which I made into child tables by embedding their forms in the project information form. They are linked by a unique project ID which is created using an autonumber. The primary child table allows the user to enter the last day of a particular month, estimated revenue for that month & actual revenue (estimates & actuals are two separate fields). I created two queries that weighted the actuals & estimates by multiplying them by the win percentage. I then took these two queries and created a new select query (qryMRAMRE) that used the IIF() with parameters. The IIF() goes something like this:
    IIF([Month]< <font color=blue>[Enter first day after last day of actuals reporting period]</font color=blue>,[WeightedActuals],IIF([Month]><font color=blue>[Enter first day of estimates reporting period]</font color=blue>,[WeightedEstimates],Null)
    Anything in <font color=blue>blue</font color=blue> is a parameter and [Month] is actually entered as the last day of the month (i.e., 01/31/04). I did a similar IIF() to pull back the appropriate month. I did this so that I could create a crosstab (qryMRAMRECrosstab) where each project line would produce actuals before a certain date & estimates after that same date all on the same line. The crosstab is pivoted by month. This is the first query that keeps crashing.
    The second query took the qryMRAMRE query and created another crosstab (qrySalesCrosstab) that summed all of a project's revenue (actuals before a certain date & estimates after) and put them under a month column that corresponded back to the project start date. Since project start dates can vary, I created a query to pull Month() and then another query to get MonthName(). I then combined these two to get the header YYYY-MM-Month (e.g., 2004-01-January) and used that new combined field as the column header in the qrySalesCrosstab query. The qrySalesCrosstab also causes the db to crash.
    Phew, I think I included everything that was really important. I also did some tables for easy upkeep of certain values for certain drop-down fields, but those were pretty simple. I hope that description makes sense.
    Would it be helpful to attach a copy of the database?

  4. #4
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: IIF() possibly causing database to crash (Access 2002)

    Yes, attach a zipped copy of your database.

  5. #5
    New Lounger
    Join Date
    Apr 2004
    Location
    Reston, Virginia, USA
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: IIF() possibly causing database to crash (Access 2002)

    Okay, I had to trim a lot out of this database (mostly forms & macros) to get it under 100K. The original is sadly about 300K when zipped. In any event, the queries causing trouble are qryMRAMRE, qryMRAMRECrosstab & qrySalesCrosstab.
    Thanks again for taking a look at this.
    Attached Files Attached Files

  6. #6
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: IIF() possibly causing database to crash (Access 2002)

    I have tried to execute the queries and tried to open them in design view, but NO GO.
    I also tried to import the tables and queries to a new database, but the problem still persists.
    All your other queries seem to work ok.
    Why don't you delete the bad queries and reconstruct them and see what happens.
    Do you want to post the SQL of those queries so we can see what you are doing.

    Other than that, I cannot help you.

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: IIF() possibly causing database to crash (Access 2002)

    The parameters in your queries are much too long, Access chokes on them. Either shorten the prompt texts significantly, or create a form with text boxes in which the user can enter the relevant dates, and use these as parameters.

  8. #8
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: IIF() possibly causing database to crash (Access 2002)

    To amplify on Hans' point, the maximum number of characters for a parameter in a parameter query is 255 (for Access 2002).
    Wendell

  9. #9
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: IIF() possibly causing database to crash (Access 2002)

    The parameters are well below 255 characters, but still, I found that making them shorter prevented Access from crashing.

  10. #10
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: IIF() possibly causing database to crash (Access 2002)

    Completely off-topic: here is a non-distorted version of your userpic.
    Attached Images Attached Images

  11. #11
    New Lounger
    Join Date
    Apr 2004
    Location
    Reston, Virginia, USA
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: IIF() possibly causing database to crash (Access 2002)

    Okay, I just logged in after a 3 day weekend and all I can say is, wow. I think shortening the parameter input text worked. We're testing it with data tomorrow. I'll let you know if it works with live data. Thank all of you so much for your help. <img src=/S/clapping.gif border=0 alt=clapping width=19 height=23>

    Oh, and Hans, regarding my user pic...that's what it originally looked like when I cropped it to the appropriate size. I think it distorts because of the orientation. I'm going to take another look at it. Thank you, though.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •