referencing a date

  • Thread starter Thread starter Basil
  • Start date Start date
B

Basil

Hi again,

I import a load of tables into a database and want to
record the date of update. I am happy to only record 1
date as all tables can only be imported at the same time.

Currently, I have a table ([Date of Update]) with 1 record
in it. When the last table is imported, this record is
updated to the system date.

The main switchboard form has a textbox (txtupddate) that
displays this date.

From this textbox, there are many functions set up in VBA,
eg start of the week date, start of the month date etc
(they were variables in VBA until recently when I made
them functions so that I could reference them within a
query). I take the assumption that the main switchboard
will always be loaded in the background.

Firstly, I do not think this is a very good method at all
and would really appreciate a better way of doing this
(Using something other than a table with 1
record?/referencing the table direct rather then the field
on the main switchboard?) - most probably a better way
that I haven't thought of.

Secondly, I wrote this code to update the main switchboard
txtupddate as soon as the tables are uploaded. It doesn't
seem to work - no errors, just doesn't do anything! Any
ideas why?:

Forms![Main Switchboard].SetFocus
DoCmd.Requery "txtupddate"
Forms![Update Tables].SetFocus

Thanks so much.
 
Basil,
I think your method using one table with one record is quite fine and efficient. To get the form to update and show the new date try placing the following code in the click event of the button on that form you use to initiate the upload.

me.requery
me.refresh
me.repaint

If none of those work then I have to wonder if your table is being updated or the if the form and control are attached to the table.

Concerning using the one table with one record, I still maintain that it is fine, however, I usually like to know when each record was imported...historically. So you would have an "ImportedDate" field in the tables which collect the data.
-Tom
 
Thanks loads,

It seems that requerying the whole form does the trick (as
you suggested). I was trying to requery the control.
-----Original Message-----
Basil,
I think your method using one table with one record
is quite fine and efficient. To get the form to update
and show the new date try placing the following code in
the click event of the button on that form you use to
initiate the upload.
me.requery
me.refresh
me.repaint

If none of those work then I have to wonder if your table
is being updated or the if the form and control are
attached to the table.
Concerning using the one table with one record, I
still maintain that it is fine, however, I usually like to
know when each record was imported...historically. So you
would have an "ImportedDate" field in the tables which
collect the data.
 
Back
Top