Connecting Tech Pros Worldwide Forums | Help | Site Map

Manipulating Date

Cillies
Guest
 
Posts: n/a
#1: Nov 13 '05
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: Nov 13 '05

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: Nov 13 '05

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: Nov 13 '05

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: Nov 13 '05

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: Nov 13 '05

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