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
![]() |
There are isolated problems with current patches, but they are well-known and documented on this site. |
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
-
Rufus is available from the MSFT Store
by
PL1
5 hours, 54 minutes ago -
Microsoft : Ending USB-C® Port Confusion
by
Alex5723
8 hours, 3 minutes ago -
KB5061768 update for Intel vPro processor
by
drmark
4 hours, 16 minutes ago -
Outlook 365 classic has exhausted all shared resources
by
drmark
6 hours, 14 minutes ago -
My Simple Word 2010 Macro Is Not Working
by
mbennett555
3 hours, 48 minutes ago -
Office gets current release
by
Susan Bradley
6 hours, 26 minutes ago -
FBI: Still Using One of These Old Routers? It’s Vulnerable to Hackers
by
Alex5723
1 day, 20 hours ago -
Windows AI Local Only no NPU required!
by
RetiredGeek
1 day, 5 hours ago -
Stop the OneDrive defaults
by
CWBillow
1 day, 21 hours ago -
Windows 11 Insider Preview build 27868 released to Canary
by
joep517
2 days, 7 hours ago -
X Suspends Encrypted DMs
by
Alex5723
2 days, 9 hours ago -
WSJ : My Robot and Me AI generated movie
by
Alex5723
2 days, 9 hours ago -
Botnet hacks 9,000+ ASUS routers to add persistent SSH backdoor
by
Alex5723
2 days, 10 hours ago -
OpenAI model sabotages shutdown code
by
Cybertooth
2 days, 10 hours ago -
Backup and access old e-mails after company e-mail address is terminated
by
M W Leijendekker
1 day, 23 hours ago -
Enabling Secureboot
by
ITguy
2 days, 6 hours ago -
Windows hosting exposes additional bugs
by
Susan Bradley
2 days, 18 hours ago -
No more rounded corners??
by
CWBillow
2 days, 14 hours ago -
Android 15 and IPV6
by
Win7and10
2 days, 4 hours ago -
KB5058405 might fail to install with recovery error 0xc0000098 in ACPI.sys
by
Susan Bradley
3 days, 7 hours ago -
T-Mobile’s T-Life App has a “Screen Recording Tool” Turned on
by
Alex5723
3 days, 9 hours ago -
Windows 11 Insider Preview Build 26100.4202 (24H2) released to Release Preview
by
joep517
3 days, 4 hours ago -
Windows Update orchestration platform to update all software
by
Alex5723
3 days, 17 hours ago -
May preview updates
by
Susan Bradley
3 days, 4 hours ago -
Microsoft releases KB5061977 Windows 11 24H2, Server 2025 emergency out of band
by
Alex5723
2 days, 20 hours ago -
Just got this pop-up page while browsing
by
Alex5723
3 days, 9 hours ago -
KB5058379 / KB 5061768 Failures
by
crown
3 days, 6 hours ago -
Windows 10 23H2 Good to Update to ?
by
jkitc
2 days, 8 hours ago -
At last – installation of 24H2
by
Botswana12
4 days, 8 hours ago -
MS-DEFCON 4: As good as it gets
by
Susan Bradley
6 hours, 41 minutes 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.