Home All Groups Group Topic Archive Search About

Show the date of the last time the query was run

Author
20 Dec 2008 2:18 PM
Mishanya
My swithboard has a button wich runs an Update query (it updates one table
fields from another table linked to Excel datasheet). I run the query only
when the data in Excel has been changed. At times I have to print some
reports with old unupdated data and only then perform the Update.
I'd like to add LastUpdate field on the switchboard, wich will show the date
when the query was run last time (in other words, a date the data is updated
to).
Creating Date field with a default value of Now() in the updated table and
then pulling it's DMax woud not help, cause the query is not adding new
records, so the max value will remain always the same (the same value of the
date of creating the records).
What can be done? Is there a way to timestamp query-run or table's
data-update?

Author
20 Dec 2008 2:39 PM
Rick Brandt
On Sat, 20 Dec 2008 06:18:00 -0800, Mishanya wrote:

> My swithboard has a button wich runs an Update query (it updates one
> table fields from another table linked to Excel datasheet). I run the
> query only when the data in Excel has been changed. At times I have to
> print some reports with old unupdated data and only then perform the
> Update. I'd like to add LastUpdate field on the switchboard, wich will
> show the date when the query was run last time (in other words, a date
> the data is updated to).
> Creating Date field with a default value of Now() in the updated table
> and then pulling it's DMax woud not help, cause the query is not adding
> new records, so the max value will remain always the same (the same
> value of the date of creating the records).
> What can be done? Is there a way to timestamp query-run or table's
> data-update?

Just have your update query update the date field to Now(). 

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt   at   Hunter   dot   com
Are all your drivers up to date? click for free checkup

Author
20 Dec 2008 3:27 PM
Mishanya
Nice! Thank U!
For general knowledge - is there any way to accomplish the task without
creating superficial and otherwise useless fields (I don't need this
LastUpdate field as such)?

Show quoteHide quote
"Rick Brandt" wrote:

> On Sat, 20 Dec 2008 06:18:00 -0800, Mishanya wrote:
>
> > My swithboard has a button wich runs an Update query (it updates one
> > table fields from another table linked to Excel datasheet). I run the
> > query only when the data in Excel has been changed. At times I have to
> > print some reports with old unupdated data and only then perform the
> > Update. I'd like to add LastUpdate field on the switchboard, wich will
> > show the date when the query was run last time (in other words, a date
> > the data is updated to).
> > Creating Date field with a default value of Now() in the updated table
> > and then pulling it's DMax woud not help, cause the query is not adding
> > new records, so the max value will remain always the same (the same
> > value of the date of creating the records).
> > What can be done? Is there a way to timestamp query-run or table's
> > data-update?
>
> Just have your update query update the date field to Now(). 
>
> --
> Rick Brandt, Microsoft Access MVP
> Email (as appropriate) to...
> RBrandt   at   Hunter   dot   com
>
Author
20 Dec 2008 4:13 PM
Rick Brandt
On Sat, 20 Dec 2008 07:27:01 -0800, Mishanya wrote:

> Nice! Thank U!
> For general knowledge - is there any way to accomplish the task without
> creating superficial and otherwise useless fields (I don't need this
> LastUpdate field as such)?


Well, in a database if you want to store data you need a table and field
to store it in.  You could have a separate table for this so that the
date only needs to be stored once instead of in every record of your
current table, but that would be more difficult to manage and ensure that
the date is correct since it would require a *separate* step from running
the update query.


--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt   at   Hunter   dot   com
Author
20 Dec 2008 3:55 PM
Mishanya
Rick
Just one more tuning quest
How can I make the switchboard LastUpdate control update it's contain (to
change the date) after the query is finished? Now it only updates after
closing and opening the form again.

Show quoteHide quote
"Rick Brandt" wrote:

> On Sat, 20 Dec 2008 06:18:00 -0800, Mishanya wrote:
>
> > My swithboard has a button wich runs an Update query (it updates one
> > table fields from another table linked to Excel datasheet). I run the
> > query only when the data in Excel has been changed. At times I have to
> > print some reports with old unupdated data and only then perform the
> > Update. I'd like to add LastUpdate field on the switchboard, wich will
> > show the date when the query was run last time (in other words, a date
> > the data is updated to).
> > Creating Date field with a default value of Now() in the updated table
> > and then pulling it's DMax woud not help, cause the query is not adding
> > new records, so the max value will remain always the same (the same
> > value of the date of creating the records).
> > What can be done? Is there a way to timestamp query-run or table's
> > data-update?
>
> Just have your update query update the date field to Now(). 
>
> --
> Rick Brandt, Microsoft Access MVP
> Email (as appropriate) to...
> RBrandt   at   Hunter   dot   com
>
Author
20 Dec 2008 4:14 PM
Rick Brandt
On Sat, 20 Dec 2008 07:55:01 -0800, Mishanya wrote:
> Rick
> Just one more tuning quest
> How can I make the switchboard LastUpdate control update it's contain
> (to change the date) after the query is finished? Now it only updates
> after closing and opening the form again.

You need to issue a Requery on it in code...

Me.ComboBoxName.Requery

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt   at   Hunter   dot   com
Author
20 Dec 2008 9:30 PM
Mishanya
In what event? And of what (the button that runs the query? the control
LastUpdateDate itself? the form?)?

Show quoteHide quote
"Rick Brandt" wrote:

> On Sat, 20 Dec 2008 07:55:01 -0800, Mishanya wrote:
> > Rick
> > Just one more tuning quest
> > How can I make the switchboard LastUpdate control update it's contain
> > (to change the date) after the query is finished? Now it only updates
> > after closing and opening the form again.
>
> You need to issue a Requery on it in code...
>
> Me.ComboBoxName.Requery
>
> --
> Rick Brandt, Microsoft Access MVP
> Email (as appropriate) to...
> RBrandt   at   Hunter   dot   com
>
Author
20 Dec 2008 9:47 PM
Rick Brandt
On Sat, 20 Dec 2008 13:30:01 -0800, Mishanya wrote:

> In what event? And of what (the button that runs the query? the control
> LastUpdateDate itself? the form?)?

Well, yes if the change you expect to see in the ComboBox is because the
query has been run then you need to run that code after the query has
been run.  If you execute the query from code then issuing the Requery in
that same code block would be appropriate.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt   at   Hunter   dot   com
Author
20 Dec 2008 10:23 PM
Mishanya
thank You!

Show quoteHide quote
"Rick Brandt" wrote:

> On Sat, 20 Dec 2008 13:30:01 -0800, Mishanya wrote:
>
> > In what event? And of what (the button that runs the query? the control
> > LastUpdateDate itself? the form?)?
>
> Well, yes if the change you expect to see in the ComboBox is because the
> query has been run then you need to run that code after the query has
> been run.  If you execute the query from code then issuing the Requery in
> that same code block would be appropriate.
>
> --
> Rick Brandt, Microsoft Access MVP
> Email (as appropriate) to...
> RBrandt   at   Hunter   dot   com
>

Bookmark and Share