Connecting Tech Pros Worldwide Help | Site Map

Manipulating Date

Cillies
Guest
 
Posts: n/a
#1: November 13th, 2005, 12:57 AM
Does anyone know if it is possible to manipulate a date field, to
change on a daily basis.


i.e.
I want to know if you can update a date field so that all dates in the
database that have dates before todays date can be automatically
updated to todays date.

This would happen on a daily basis.

Kindest Regards
Douglas J. Steele
Guest
 
Posts: n/a
#2: November 13th, 2005, 12:57 AM

re: Manipulating Date


UPDATE MyTable
SET MyDateField = Date()
WHERE MyDateField < Date()

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Cillies" <lee@prologic.ie> wrote in message
news:ba262325.0406180716.4a62d7ee@posting.google.c om...[color=blue]
> Does anyone know if it is possible to manipulate a date field, to
> change on a daily basis.
>
>
> i.e.
> I want to know if you can update a date field so that all dates in the
> database that have dates before todays date can be automatically
> updated to todays date.
>
> This would happen on a daily basis.
>
> Kindest Regards[/color]


devdex.com
Guest
 
Posts: n/a
#3: November 13th, 2005, 12:58 AM

re: Manipulating Date




Do I place that code in the SQL of the Query for the form.

If so Do I place it before or after the FROM clause

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Douglas J. Steele
Guest
 
Posts: n/a
#4: November 13th, 2005, 12:58 AM

re: Manipulating Date


That IS the SQL for the query.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"devdex.com" <anonymous@devdex.com> wrote in message
news:40d3140f$0$16447$c397aba@news.newsgroups.ws.. .[color=blue]
>
>
> Do I place that code in the SQL of the Query for the form.
>
> If so Do I place it before or after the FROM clause
>
> *** Sent via Devdex http://www.devdex.com ***
> Don't just participate in USENET...get rewarded for it![/color]


Salad
Guest
 
Posts: n/a
#5: November 13th, 2005, 12:58 AM

re: Manipulating Date


devdex.com wrote:[color=blue]
>
> Do I place that code in the SQL of the Query for the form.
>
> If so Do I place it before or after the FROM clause
>
> *** Sent via Devdex http://www.devdex.com ***
> Don't just participate in USENET...get rewarded for it![/color]

You could create a query like Doug showed. You need to change the Table
and field names to reflect the table/field in your database.

It depends on when you want to update the dates. You could call the
query from an autoexec macro (read help on how to create a macro) which
will fire when you open the database.
Let's say the query is called UpdateDates. You could also enter a
command like
Currentdb.Execute "UpdateDates"
in the OnOpen event of the form that loads when you open the application.



Pieter Linden
Guest
 
Posts: n/a
#6: November 13th, 2005, 12:58 AM

re: Manipulating Date


lee@prologic.ie (Cillies) wrote in message news:<ba262325.0406180716.4a62d7ee@posting.google. com>...[color=blue]
> Does anyone know if it is possible to manipulate a date field, to
> change on a daily basis.
>
>
> i.e.
> I want to know if you can update a date field so that all dates in the
> database that have dates before todays date can be automatically
> updated to todays date.
>
> This would happen on a daily basis.
>
> Kindest Regards[/color]

Write as many queries as you need to in order to update all of the
tables you need to update. Then create an AutoExec macro and call the
update queries from there.
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Date poition comparison of a datetime field colinhumber answers 1 July 23rd, 2005 10:04 AM
Date and time conversion Roger Leigh answers 1 July 22nd, 2005 11:13 AM
Cookie Expire Date question What-a-Tool answers 7 July 22nd, 2005 03:29 AM
Convert User entered date and time to Unix Timestamp before inserting to database perplexed answers 13 July 17th, 2005 11:00 AM