Form Name: Company
Table Name: Company
consists Company ID as primary key, and other company related info,
name, phone number, and Date and Time (all separate rows)
B)
WHen I push again, or I access the same record on my form again, and
activate the button, it replaces the ols Date and old Time with the new
ones, so, it overwrites.
What is the VB code for A and B?
I guess must be placed in "On Click".
Bart
Access 2003
First off, don't use "Date" or "Time" for field names as they're reserved
words in Access. For my example I've assumed control names are "txtDate"
and "txtTime" bound to your date and time fields.
Create a command button and out this in its on click event:
Me.txtDate = Date
Me.txtTime = Time()
Me.Refresh
HTH - Keith.
www.keithwilby.com
Look at the answer that Keith gave you for the solution, but ...
-- what do you want to achieve?
-- why recording the date and time?
If you want the date and time recorded when the record has changed you simply use the forms' afterupdate-event.
If you want the date and time recorded when the record is viewed you simply use the forms' oncurrent-event.
(Same code as Keith gave you)
No need to click any button maybe...
But you may have your reasons to use a button...
Arno R
> If you want the date and time recorded when the record has
> changed you simply use the forms' afterupdate-event.
Use the ***BeforeUpdate*** event, not AfterUpdate.
--
Bob Quintal
PA is y I've altered my email address.
--
Posted via a free Usenet account from http://www.teranews.com
The reason why I wanted the descried question, is:
I do have a Note (memoblock) on my form and every time there is any
progression/ modification, we have to push on the date-insert button,
which insert "(date) ----" at the end of the memo block xontents,
before we fill in some text.
Together with the date insert action, I added date and time for the
combo-box. Now the most recent modifed records are on top of the list
since I order by date and time. Without the insert date in the memo
block, the record is not considered modified.
See the discission on
http://groups.google.com/group/comp.databases.ms-access/browse_frm/thread/e1190eba19e4e62f/4f8340fa64437ede?lnk=st&q=aa+arens&rnum=2#4f8340fa64437ede
Thanks to all.
Bart
Yep, you are right Bob. Sorry for the mistake.
Arno R
"Me." will work if you're referencing a text box name. What error message
do you get?
Bart
Me.txtDate = Date
Me.txtTime = Time()
Me.Refresh
In BeforeUpdate, the Refreh command is fault.
Beside that, the record is not considered modifed when I type some text
in the Notes. There is not add of date and time, when the Refresh is
disabled (').
Let's look at this:
When I approach a record, is it possible to have it considered modified
(date and time added) when I view-only the record a minimum of seconds?
Because I want to have also a recently modifed record when I only
approach it (to look for the contents). But a minimum of x seconds,
otherwise all records will be considered modifed when I navigate though
the records!
Bart
When you're in the middle of a data writing sequence, as you are when you
fire off BeforeUpdate, don't attempt form- or recordset- level operations.
You are bumping into the write sequence.