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, 1 month 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
-
Windows 11 Insider Preview build 27863 released to Canary
by
joep517
14 hours, 21 minutes ago -
Windows 11 Insider Preview build 26120.4161 (24H2) released to BETA
by
joep517
14 hours, 22 minutes ago -
AI model turns to blackmail when engineers try to take it offline
by
Cybertooth
7 hours, 6 minutes ago -
Migrate off MS365 to Apple Products
by
dmt_3904
10 hours, 31 minutes ago -
Login screen icon
by
CWBillow
5 hours, 46 minutes ago -
AI coming to everything
by
Susan Bradley
14 hours, 32 minutes ago -
Mozilla : Pocket shuts down July 8, 2025, Fakespot shuts down on July 1, 2025
by
Alex5723
1 day, 6 hours ago -
No Screen TurnOff???
by
CWBillow
1 day, 6 hours ago -
Identify a dynamic range to then be used in another formula
by
BigDaddy07
1 day, 6 hours ago -
InfoStealer Malware Data Breach Exposed 184 Million Logins and Passwords
by
Alex5723
1 day, 18 hours ago -
How well does your browser block trackers?
by
n0ads
1 day, 4 hours ago -
You can’t handle me
by
Susan Bradley
4 hours, 48 minutes ago -
Chrome Can Now Change Your Weak Passwords for You
by
Alex5723
21 hours, 27 minutes ago -
Microsoft: Over 394,000 Windows PCs infected by Lumma malware, affects Chrome..
by
Alex5723
2 days, 5 hours ago -
Signal vs Microsoft’s Recall ; By Default, Signal Doesn’t Recall
by
Alex5723
1 day, 9 hours ago -
Internet Archive : This is where all of The Internet is stored
by
Alex5723
2 days, 6 hours ago -
iPhone 7 Plus and the iPhone 8 on Vantage list
by
Alex5723
2 days, 6 hours ago -
Lumma malware takedown
by
EyesOnWindows
1 day, 18 hours ago -
“kill switches” found in Chinese made power inverters
by
Alex5723
2 days, 15 hours ago -
Windows 11 – InControl vs pausing Windows updates
by
Kathy Stevens
2 days, 15 hours ago -
Meet Gemini in Chrome
by
Alex5723
2 days, 19 hours ago -
DuckDuckGo’s Duck.ai added GPT-4o mini
by
Alex5723
2 days, 19 hours ago -
Trump signs Take It Down Act
by
Alex5723
3 days, 3 hours ago -
Do you have a maintenance window?
by
Susan Bradley
1 day, 7 hours ago -
Freshly discovered bug in OpenPGP.js undermines whole point of encrypted comms
by
Nibbled To Death By Ducks
2 days, 5 hours ago -
Cox Communications and Charter Communications to merge
by
not so anon
3 days, 6 hours ago -
Help with WD usb driver on Windows 11
by
Tex265
17 hours, 48 minutes ago -
hibernate activation
by
e_belmont
3 days, 15 hours ago -
Red Hat Enterprise Linux 10 with AI assistant
by
Alex5723
3 days, 19 hours ago -
Windows 11 Insider Preview build 26200.5603 released to DEV
by
joep517
3 days, 22 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.