473,473 Members | 1,758 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Updating DATES

Hi,

I have created a simple update query, that updates the date everyday.
i.e. any date before today's date will be updated to todays date. I
have it running on an autoexec. macro

But I want to be able to update it every 7 days, but at the same time
take into consideration the weekends. I just want to use the 5 working
days of the week (Mon-Fri)and not the weekends (Sat, Sun). for
example, if today is Tuesday and I have 37 date entries for monday I
want to update those 37 entries to the following wednesday (7 working
days later).

Hope someone can help
Nov 13 '05 #1
2 1546
"Cillies" <le*@prologic.ie> wrote in message
news:ba**************************@posting.google.c om...
Hi,

I have created a simple update query, that updates the date everyday.
i.e. any date before today's date will be updated to todays date. I
have it running on an autoexec. macro

But I want to be able to update it every 7 days, but at the same time
take into consideration the weekends. I just want to use the 5 working
days of the week (Mon-Fri)and not the weekends (Sat, Sun). for
example, if today is Tuesday and I have 37 date entries for monday I
want to update those 37 entries to the following wednesday (7 working
days later).

Hope someone can help


I'm trying to think of a good reason you would need to do this. Why use a
stored date at all? You could just use an expression that calculates the
current date on the fly couldn't you?

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Nov 13 '05 #2
Cillies wrote:
Hi,

I have created a simple update query, that updates the date everyday.
i.e. any date before today's date will be updated to todays date. I
have it running on an autoexec. macro

But I want to be able to update it every 7 days, but at the same time
take into consideration the weekends. I just want to use the 5 working
days of the week (Mon-Fri)and not the weekends (Sat, Sun). for
example, if today is Tuesday and I have 37 date entries for monday I
want to update those 37 entries to the following wednesday (7 working
days later).

Hope someone can help


Look at the weekday() function in help. Today is Thursday, June 24.
? date()
6/24/2004
? weekday(date(),vbSunday)
5
? weekday(date(),vbMonday)
4

The default for WeekDay is vbSunday so you need to determine which day
is going to be the starting day in your calculations. If today was
Monday and you used VbMonday the number would be 1.

You know that any weekday (Mon-Thu) you would add 8 days. If today's
date is Friday, I you'd add 10. So you could do something like
Expr1 : dateAdd("d", IIF(Weekday(date(),vbMonday) _
< 5 ,8,10),Date())
This says, if the weekday is less than Friday (using Monday as starting
point), add 8 days else add 10 days.

Caveat: If this is an autoexec macro, and you open this database on the
weekend, it will fire. So you may want to add another IIF() to see if
it is Friday and add 10 days otherwise add 0.

Expr1 : dateAdd("d", IIF(Weekday(date(),vbMonday) _
< 5 ,8,IIF(Weekday(date(),vbMonday) = 5,10,0)),Date())
or something like that. Next, you may need to make some adjustments for
holidays and you are on your own on that.
Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Simon | last post by:
Hello, I am trying to update some varchar2 fields, which are storing dates. I am trying to set a 'to date' with the next minumum from date i.e from date | to date 01/01/1901 ...
1
by: Dthmtlgod | last post by:
I am using a short date format (mm/dd/yy). When I enter in a date and run my update query, it is not accepting the data it puts in 12/30/1899 Here is the response.write of my SQL statement. ...
6
by: Marlene | last post by:
Hi All I have the following scenario, where I have found all the duplicates in a table, based on an order number and a part number (item).I might have something like this: Order PODate Rec...
3
by: Brett Romero | last post by:
Is there a way to update data in a DataTable cell? I have column dates that are string type. I want to add another column to this table: dt.Columns.Add(new DataColumn("Datecolumn2",...
1
by: jman | last post by:
i've got a script that runs for a while... each time thru a loop - i'd like to update a page element (i.e. a progress bar). but it doesn't seem to happen - because i think pages are not...
1
by: ltctom | last post by:
I have a DB with multiple entries for each SSN. If a particular SSN has 10 records, I want to loop through these to compare start dates for an event. If the start dates are the same, I want to...
9
by: Marianne160 | last post by:
Hi, I know there are various answers to this problem available on the web but none of them seem to work for me. I am using Access 2003 to make a form to look up data from a table. I have so far...
1
by: EyeHawk | last post by:
OK, hopefully somebody can help me out again. My next problem is updating 3 form fields (type list/menu option) that correspond to a date, one for month, one for day and one for year when the user...
9
by: LucasLondon | last post by:
Hi, Sorry, this is a bit of a lengthy one but I guess too much information is better than less! I have an excel worksheet that I update regulary with latest values from downloaded CSV files....
2
tdw
by: tdw | last post by:
Hi all, I have several ideas on how to do this, but am having difficulty putting the ideas together and figuring out the most efficient way to do this. I have a database of survey coordinate...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.