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!
Thank you!
Stacy
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
IIF() possibly causing database to crash (Access 2002)
Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » IIF() possibly causing database to crash (Access 2002)
- This topic has 18 replies, 4 voices, and was last updated 21 years, 2 months ago.
AuthorTopicWSSwood
AskWoody LoungerApril 1, 2004 at 8:49 pm #403159Viewing 1 reply threadAuthorReplies-
WSHansV
AskWoody LoungerApril 1, 2004 at 9:13 pm #808342Welcome 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?
-
WSSwood
AskWoody LoungerApril 1, 2004 at 9:39 pm #808384Thank 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]< [Enter first day after last day of actuals reporting period],[WeightedActuals],IIF([Month]>[Enter first day of estimates reporting period],[WeightedEstimates],Null)
Anything in 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? -
WSpatt
AskWoody Lounger -
WSSwood
AskWoody LoungerApril 2, 2004 at 2:24 pm #808908 -
WSpatt
AskWoody LoungerApril 2, 2004 at 9:25 pm #809065I 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.
-
WSHansV
AskWoody Lounger -
WSHansV
AskWoody Lounger -
WBell
AskWoody_MVP -
WSHansV
AskWoody Lounger -
WBell
AskWoody_MVP -
WSHansV
AskWoody Lounger -
WSSwood
AskWoody LoungerApril 6, 2004 at 9:34 pm #810968Okay, 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.
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.
-
WSSwood
AskWoody LoungerApril 6, 2004 at 9:34 pm #810969Okay, 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.
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.
-
WSHansV
AskWoody Lounger
-
-
-
WSSwood
AskWoody LoungerApril 2, 2004 at 2:24 pm #808909
-
-
-
WSpatt
AskWoody Lounger
WSSwood
AskWoody LoungerApril 1, 2004 at 9:39 pm #808385Thank 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]< [Enter first day after last day of actuals reporting period],[WeightedActuals],IIF([Month]>[Enter first day of estimates reporting period],[WeightedEstimates],Null)
Anything in 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?WSHansV
AskWoody LoungerApril 1, 2004 at 9:13 pm #808343Welcome 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?
Viewing 1 reply thread -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
EchoLeak : Zero Click M365 Copilot leak sensitive information
by
Alex5723
1 hour, 12 minutes ago -
24H2 may not be offered June updates
by
Susan Bradley
1 hour, 21 minutes ago -
Acronis : Tracking Chaos RAT’s evolution (Windows, Linux)
by
Alex5723
13 hours, 46 minutes ago -
Turning off OneDrive
by
CWBillow
18 hours, 15 minutes ago -
June 2025 updates are out
by
Susan Bradley
55 minutes ago -
Mozilla shutting Deep Fake Detector
by
Alex5723
1 day, 4 hours ago -
Windows-Maintenance-Tool (.bat)
by
Alex5723
13 hours, 54 minutes ago -
Windows 11 Insider Preview build 26200.5641 released to DEV
by
joep517
1 day, 7 hours ago -
Windows 11 Insider Preview build 26120.4250 (24H2) released to BETA
by
joep517
1 day, 7 hours ago -
Install Office 365 Outlook classic on new Win11 machine
by
WSrcull999
1 day, 7 hours ago -
win 10 to win 11 with cpu/mb replacement
by
aquatarkus
22 hours, 56 minutes ago -
re-install Windows Security
by
CWBillow
1 day, 10 hours ago -
WWDC 2025 Recap: All of Apple’s NEW Features in 10 Minutes!
by
Alex5723
1 day, 14 hours ago -
macOS Tahoe 26
by
Alex5723
1 day, 8 hours ago -
Migrating from win10 to win11, instructions coming?
by
astro46
1 hour, 19 minutes ago -
Device Eligibility for Apple 2026 Operating Systems due this Fall
by
PKCano
22 hours, 47 minutes ago -
Recommended watching : Mountainhead movie
by
Alex5723
23 hours, 31 minutes ago -
End of support for Windows 10
by
Old enough to know better
7 hours, 3 minutes ago -
What goes on inside an LLM
by
Michael Covington
17 hours, 41 minutes ago -
The risk of remote access
by
Susan Bradley
54 minutes ago -
The cruelest month for many Office users
by
Peter Deegan
1 hour, 32 minutes ago -
Tracking protection and trade-offs in Edge
by
Mary Branscombe
1 day, 3 hours ago -
Supreme Court grants DOGE access to confidential Social Security records
by
Alex5723
2 days, 12 hours ago -
EaseUS Partition Master free 19.6
by
Alex5723
1 day, 13 hours ago -
Microsoft : Edge is better than Chrome
by
Alex5723
3 days, 1 hour ago -
The EU launched DNS4EU
by
Alex5723
3 days, 14 hours ago -
Cell Phone vs. Traditional Touchtone Phone over POTS
by
280park
3 days, 4 hours ago -
Lost access to all my networked drives (shares) listed in My Computer
by
lwerman
3 days, 19 hours ago -
Set default size for pasted photo to word
by
Cyn
4 days, 1 hour ago -
Dedoimedo tries 24H2…
by
Cybertooth
3 days, 13 hours ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.