Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Calculated Field Formula
Lisa Hanes 
     
2 months ago
I have 3 fields
ccDate     -This is a date a concern was opened
WaitingDate-This is the date a concern was changed from "Open" to "Waiting" (to verify)
ClosedDate  -Date a concern was closed.

I'm trying to calculate Days Open -(To waiting status- or directly to closed)
Days Waiting, & Days to Close.  I tried to enter the following formula for a calculated field & it is not working.  Can you tell me how it has to be modified?

IIf([WaitingDate]<>0 And [ClosedDate]=0,[WaitingDate]-[CCDate],IIf([WaitingDate]<>0 And [ClosedDate]<>0,[WaitingDate]-[CCDate],IIf([WaitingDate]=0 And [ClosedDate]<>0,[ClosedDate]-[CCDate],Date()-[CCDate])))
Kevin Robertson  @Reply  
          
2 months ago
Does this give you the results you are expecting?

DaysOpen: IIf(Not IsNull([WaitingDate]) And IsNull([ClosedDate]),[WaitingDate]-[CCDate],IIf(Not IsNull([WaitingDate]) And Not IsNull([ClosedDate]),[ClosedDate]-[CCDate],IIf(IsNull([WaitingDate]) And Not IsNull([ClosedDate]),[ClosedDate]-[CCDate],Date()-[CCDate])))
Lisa Hanes OP  @Reply  
     
2 months ago
I copied and pasted the formula above....
I still get the following error:
The expression you entered has an invalid . (dot) or ! operator or invalid parentheses.
You may have entered an invalid identifier or typed parentheses following the Null constant.
Kevin Robertson  @Reply  
          
2 months ago
Where are you entering it?
I used a query and it worked perfectly.
Lisa Hanes OP  @Reply  
     
2 months ago
Thank you for your help.  I can get it to work in a query- but that created other concerns on another form.  I was trying to see if I could get it to work as a calculated field in a table.
Kevin Robertson  @Reply  
          
2 months ago
Calculated Fields in Tables - Evil Access Stuff
Richard Rost  @Reply  
          
2 months ago
Kevin's right. This works fine in a query, but calculated fields in tables are very limited and are usually not where you want to put logic like this.

Table-level calculated fields sound handy at first, but once you need anything beyond a simple expression, they turn into a Ferengi contract. Lots of rules, lots of restrictions, and somehow you still don't get what you actually want.

In Access, this kind of calculation is much better handled in a query, on a form, or in a report, depending on where you need to use it. Once you start involving multiple dates, Null checks, and conditional logic, table calculated fields become more trouble than they're worth.

Also, from a design standpoint, values like Days Open and Days Waiting are derived values, not data you should store in the table anyway. They should be calculated when needed based on the actual dates so they always stay accurate.

So yes, query = good. Table calculated field = usually no bueno.
Lisa Hanes OP  @Reply  
     
2 months ago
Thank you.  I'll work it out with the query.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/17/2026 5:05:23 AM. PLT: 0s