Show the date of the last time the query was run

M

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?
 
R

Rick Brandt

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().
 
M

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)?
 
M

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.
 
R

Rick Brandt

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.
 
R

Rick Brandt

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
 
M

Mishanya

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

Rick Brandt

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.
 
M

Mishanya

thank You!

Rick Brandt said:
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.
 

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