Date and time stamp

G

gavin

I would like to be able to have the date and time that each record is
entered recorded automatically in my database. It is only a simple one table
database (basically just names and addresses) and I have a data input form
as a user interface. I don't want the date and time to appear on the form
but merely get entered into the underlying table - is this possible? If it
is I assume it would require some VB. I am a VB newbie so please be gentle
with me!

Can I take this opportunity to ask another question? The database in
question is on a shared network drive and currently 4 users have permission
to write to it (via permissions granted to the folder the database is in).
Is there a way of automatically recording which user has entered which
record?


Thanks for any help you can give me.



Gavin
 
G

Guest

Add A DateTime field to your table. Set the default to Now(). Remove this Date Time field from any forms you don't want it to display on ...
 
C

Chris Nebinger

Yes to both.

Saving the time the record is entered is easier than when
it was modified. Create a new field, name it DateUpdated,
and set it's default value to =Now()

For the user, which username do you want? The window's
login? FOr that:

Create a new field, name it User. In it's default
property, set = fOSUserName()

Now, create a new module. paste the code from
http://www.mvps.org/access/api/api0008.htm

Close it, save it, and test it.


Chris Nebinger
 
C

Chris Nebinger

Upon looking at it, you can't use a user defined function
as the default value. Never knew that.

So, you can only do it on the form that you use to create
the data. On the User control, add the fOSUserName() to
the default value of the control. YOu can set it's
visible property to false then so the user can't change it.


Chris NEbinger
 
C

Chris Nebinger

Upon looking at it, you can't use a user defined function
as the default value. Never knew that.

So, you can only do it on the form that you use to create
the data. On the User control, add the fOSUserName() to
the default value of the control. YOu can set it's
visible property to false then so the user can't change it.


Chris NEbinger
 
G

gavin

Both solutions work really - thanks so much. Can I just ask if it would be
possible to tweak the date/time solution?

To have =Now() as the default value of the date/time field causes the date
and time to be entered into the new record as soon as the focus moves into
that record (i.e. by hitting the TAB key or ENTER key). However, that new
record could remain "blank" for quite some time before data is entered into
it - therefore the date and time stamp won't be accurate. Is there a way of
having the date and time entered automatically once data has been entered
into the record?


Best wishes,



Gavin
 

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