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
-
Win 11 24H2 June 2025 Update breaks WIFI
by
dportenlanger
2 hours, 54 minutes ago -
Update from WinPro 10 v. 1511 on T460p?
by
CatoRenasci
12 minutes ago -
System Restore and Updates Paused
by
veteran
5 hours, 24 minutes ago -
Windows 10/11 clock app
by
Kathy Stevens
1 hour, 40 minutes ago -
Turn off right-click draw
by
Charles Billow
8 hours, 38 minutes ago -
Introducing ChromeOS M137 to The Stable Channel
by
Alex5723
12 hours, 9 minutes ago -
Brian Wilson (The Beach Boys) R.I.P
by
Alex5723
1 hour, 13 minutes ago -
Master patch listing for June 10, 2025
by
Susan Bradley
13 hours, 46 minutes ago -
Suggestions for New All in One Printer and a Photo Printer Windows 10
by
Win7and10
5 hours, 48 minutes ago -
Purchasing New Printer. Uninstall old Printer Software First?
by
Win7and10
19 hours, 48 minutes ago -
KB5060842 Issue (Minor)
by
AC641
1 day ago -
EchoLeak : Zero Click M365 Copilot leak sensitive information
by
Alex5723
1 day, 2 hours ago -
24H2 may not be offered June updates
by
Susan Bradley
1 hour, 31 minutes ago -
Acronis : Tracking Chaos RAT’s evolution (Windows, Linux)
by
Alex5723
1 day, 15 hours ago -
June 2025 updates are out
by
Susan Bradley
3 hours, 45 minutes ago -
Mozilla shutting Deep Fake Detector
by
Alex5723
2 days, 6 hours ago -
Windows-Maintenance-Tool (.bat)
by
Alex5723
1 day, 15 hours ago -
Windows 11 Insider Preview build 26200.5641 released to DEV
by
joep517
2 days, 8 hours ago -
Windows 11 Insider Preview build 26120.4250 (24H2) released to BETA
by
joep517
2 days, 8 hours ago -
Install Office 365 Outlook classic on new Win11 machine
by
WSrcull999
2 days, 8 hours ago -
win 10 to win 11 with cpu/mb replacement
by
aquatarkus
2 days ago -
re-install Windows Security
by
CWBillow
2 days, 12 hours ago -
WWDC 2025 Recap: All of Apple’s NEW Features in 10 Minutes!
by
Alex5723
2 days, 15 hours ago -
macOS Tahoe 26
by
Alex5723
2 days, 9 hours ago -
Migrating from win10 to win11, instructions coming?
by
astro46
36 minutes ago -
Device Eligibility for Apple 2026 Operating Systems due this Fall
by
PKCano
2 days ago -
Recommended watching : Mountainhead movie
by
Alex5723
2 days, 1 hour ago -
End of support for Windows 10
by
Old enough to know better
1 minute ago -
What goes on inside an LLM
by
Michael Covington
58 minutes ago -
The risk of remote access
by
Susan Bradley
1 minute 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.