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 Developer Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Query Due date
Teri Bridges 
    
4 years ago
I have a duedate I want to write an expression in my query if the due date falls on a sunday add a day so that the due date will be moved to Monday

IIF(weekday[duedate]=1)+1) this does not work still learning.

Can anyone help with this?
Kevin Robertson  @Reply  
          
4 years ago
The syntax is wrong. IIF

X: IIf(Weekday([DueDate])=1, [DueDate]+1, [DueDate])
Teri Bridges OP  @Reply  
    
4 years ago
I think I got it
=IIF(Weekday([duedate])=1,[duedate]+1,IIF(Weekday([duedate])=7,[duedate]+1))

But now I need to add else [startdate]+3
Teri Bridges OP  @Reply  
    
4 years ago
I just cant quite get it

Expr2: IIf(Weekday([duedate])=1,[duedate]+1,else([startdate]+3)
Teri Bridges OP  @Reply  
    
4 years ago
that was not right because I did not define due date first, I think

so let's see I am trying to say my due date =my startdate +3 and iif my due date falls on a sunday +1

exp1:=([duedate]=[startdate]+3), and IIF((Weekday([duedate])=1,[duedate]+1)

Oh I am confusing myself
Teri Bridges OP  @Reply  
    
4 years ago

Adam Schwanz  @Reply  
           
4 years ago
So right now you have if duedates weekday is 1, put duedate+1, else if duedates weekday is 7, put duedate+1

I'm assuming if it's 7 (Saturday) you would do +2? To land on monday.

IIF(WeekDay(DueDate)=1,DueDate+1,IIF(WeekDay(DueDate)=7,DueDate+2,DueDate))

Basically saying what you had, but if it's saturday add 2, and if it's not saturday or sunday, put the actual due date. That's probably the cleanest way to do it. You can just hide your duedate field how you have it currently than change Expr1 to RealDueDate: IIF statement

Or you can rename the duedate field (substituting in the new name into the IIF statement), and do
DueDate: IIF statement
Teri Bridges OP  @Reply  
    
4 years ago
So there is no was to make it so duedate is startdate+3
something like either of these
duedate=[startdate]+3 and IIF(Weekday([duedate])=1,[duedate]+1,IIF(Weekday([duedate])=7,[duedate]+1))

duedate=IIF(Weekday([duedate])=1,[duedate]+1,IIF(Weekday([duedate])=7,[duedate]+1)) else [startdate]+3

this does not work as I have written it of course.
Adam Schwanz  @Reply  
           
4 years ago
I guess you can do something like this

DueDate: IIF(Weekday(StartDate)=4,StartDate+5,IIF(WeekDay(StartDate)=5,StartDate+4,StartDate+3))
Adam Schwanz  @Reply  
           
4 years ago
Basically saying if the start date was Wednesday, the due date would be Saturday, add 5 to it to get to Monday. If the start date is Thursday, the due date would be Sunday, add 4 to it to get the Monday. Any other startdate just add 3 days to it.
Teri Bridges OP  @Reply  
    
4 years ago
I understand, thank you. Huge help.

I have a new one if the status is "Overdue" take the duedate-Date() and return the value.
Teri Bridges OP  @Reply  
    
4 years ago
Absolutely brilliant. Worked perfectly!! I hope I get this down.
DueDate: IIF(Weekday(StartDate)=4,StartDate+5,IIF(WeekDay(StartDate)=5,StartDate+4,StartDate+3))

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Developer 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/8/2026 10:07:23 PM. PLT: 1s