Query for dates

G

Guest

Hi,

i have some records that are dates, these are say the date an order is made,
i need to calculate the next friday from that date for a delievery, so once i
have entered a date that the order has been made, i need an expression that
will calculate the delievery date being the next possible friday.

if an order is made on firday it is sill possible to deliever it on the same
day.

thanks
 
O

Ofer Cohen

Try someting like

DateAdd("d",6-IIf(WeekDay([DateFieldName]) =
7,0,WeekDay([DateFieldName])),[DateFieldName])


Good Luck
BS"D
 
G

Guest

Whooha....thanks...but could i ask something about this, could you like break
down what the whole function does, i need to learn this, so i can see that
you have used a function " to add days to the [DateFieldName] but i get
confused after that, the function works supherb its just that i need to
understand what it means.

Thank you soooo much tho....

Ofer Cohen said:
Try someting like

DateAdd("d",6-IIf(WeekDay([DateFieldName]) =
7,0,WeekDay([DateFieldName])),[DateFieldName])


Good Luck
BS"D


Moose said:
Hi,

i have some records that are dates, these are say the date an order is made,
i need to calculate the next friday from that date for a delievery, so once i
have entered a date that the order has been made, i need an expression that
will calculate the delievery date being the next possible friday.

if an order is made on firday it is sill possible to deliever it on the same
day.

thanks
 
G

Guest

First, I'm glad it works

Now for each function
==============================
DateAdd("d", NumberOfDays, DateField)

The DateAdd function will add number of days to a specific date (check help,
you can also add hours , days , months etc)
==============================
WeekDay(DateField)

Will return the day number
Sunday = 1
Monday = 2
etc
===============================
In this calculation I added to the date fields the number of days to get to
the next friday

===============================
The problem I had is with Suterday which equal to 7 and it not less then 6,
so in that ase I used to IIf condition to check if it's suterday, if it is I
added 6, if it wasn't I added 6 - The week day number

===============================
I hope I make sense, and you are not more confused now

--
Good Luck
BS"D


Moose said:
Whooha....thanks...but could i ask something about this, could you like break
down what the whole function does, i need to learn this, so i can see that
you have used a function " to add days to the [DateFieldName] but i get
confused after that, the function works supherb its just that i need to
understand what it means.

Thank you soooo much tho....

Ofer Cohen said:
Try someting like

DateAdd("d",6-IIf(WeekDay([DateFieldName]) =
7,0,WeekDay([DateFieldName])),[DateFieldName])


Good Luck
BS"D


Moose said:
Hi,

i have some records that are dates, these are say the date an order is made,
i need to calculate the next friday from that date for a delievery, so once i
have entered a date that the order has been made, i need an expression that
will calculate the delievery date being the next possible friday.

if an order is made on firday it is sill possible to deliever it on the same
day.

thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top