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
-
Microsoft : Edge is better than Chrome
by
Alex5723
41 minutes ago -
The EU launched DNS4EU
by
Alex5723
51 minutes ago -
Cell Phone vs. Traditional Touchtone Phone over POTS
by
280park
6 hours, 26 minutes ago -
Lost access to all my networked drives (shares) listed in My Computer
by
lwerman
6 hours, 17 minutes ago -
Set default size for pasted photo to word
by
Cyn
12 hours, 19 minutes ago -
Dedoimedo tries 24H2…
by
Cybertooth
25 minutes ago -
Windows 11 Insider Preview build 27871 released to Canary
by
joep517
1 day, 11 hours ago -
Windows 11 ad from Campaign Manager in Windows 10
by
Jim McKenna
1 day, 8 hours ago -
Small desktops
by
Susan Bradley
1 hour, 57 minutes ago -
Totally disable Bitlocker
by
CWBillow
4 hours, 51 minutes ago -
Phishers extract Millions from HMRC accounts..
by
Microfix
1 day, 8 hours ago -
Windows 10 22H2 Update today (5 June) says up-to-date but last was 2025-04
by
Alan_uk
2 days, 15 hours ago -
Thoughts on Malwarebytes Scam Guard for Mobile?
by
opti1
9 hours, 59 minutes ago -
Mystical Desktop
by
CWBillow
2 days, 18 hours ago -
Meta and Yandex secretly tracked billions of Android users
by
Alex5723
1 day, 23 hours ago -
MS-DEFCON 2: Do you need that update?
by
Susan Bradley
15 hours, 47 minutes ago -
CD/DVD drive is no longer recognized
by
WSCape Sand
3 days, 9 hours ago -
Windows 11 24H2 Default Apps stuck on Edge and Adobe Photoshop
by
MikeBravo
3 days, 12 hours ago -
North Face and Cartier customer data stolen in cyber attacks
by
Alex5723
3 days, 10 hours ago -
What is wrong with simple approach?
by
WSSpoke36
1 day, 8 hours ago -
Microsoft-Backed Builder.ai Set for Bankruptcy After Cash Seized
by
Alex5723
3 days, 22 hours ago -
Location, location, location
by
Susan Bradley
2 days, 12 hours ago -
Cannot get a task to run a restore point
by
CWBillow
3 days, 23 hours ago -
Frustrating search behavior with Outlook
by
MrJimPhelps
3 days, 14 hours ago -
June 2025 Office non-Security Updates
by
PKCano
4 days, 10 hours ago -
Secure Boot Update Fails after KB5058405 Installed
by
SteveIT
5 hours, 49 minutes ago -
Firefox Red Panda Fun Stuff
by
Lars220
4 days, 10 hours ago -
How start headers and page numbers on page 3?
by
Davidhs
4 days, 20 hours ago -
Attack on LexisNexis Risk Solutions exposes data on 300k +
by
Nibbled To Death By Ducks
3 days, 23 hours ago -
Windows 11 Insider Preview build 26200.5622 released to DEV
by
joep517
5 days, 5 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.