p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Access (http://p2p.wrox.com/forumdisplay.php?f=18)
-   -   datediff (http://p2p.wrox.com/showthread.php?t=45796)

ebburks July 27th, 2006 03:03 PM

datediff
 
Hi
I am using the datediff to get the difference between two days from two form control fields.
I have setup one table that I have enter dates from 1/01/2006 to 12/31/2006. I have made a query that omits holidays and weekends and assigned them to each one of the form control fields. However when I use the datediff function to show the day difference from the two diff dates selected in each field it is still including weekends and holidays in the date difference. How do I get it to just give me the difference between the days in the query?

EB

mmcdonal July 28th, 2006 09:42 AM

This is a problem I have found with VBA. In the MSDN refernce for the DateDiff Function, MS refernces "w" as the interval to use for "Weekday." However, w returns the weeks.

What I have done is to take each date, check its day of the week value, if it is between 2 and 6, add 1 to a variable, and then display the total. This wouldn't help much in a query. Perhaps you can create a function that does this when the fields in your table are updated, and actually store the values in the table.

I have written the function if you want to use it.

HTH


mmcdonal

ebburks July 28th, 2006 06:58 PM

Thank you very much. However, I went a different route. I am able to get what I needed.
Again, thank you

EB


All times are GMT -4. The time now is 12:21 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.