Insert date/time into a field (shortcut)?

R

RitchieJHicks

I have written a new application which includes a "notes" field so my staff
to write notes about a particular record.

This use to be set up as a notepad.exe file in a folder - staff would open
the file and pressed "F5" to automatically insert the current date and time.
This does not work in the memo field of an access database. Is there a fix or
shortcut within access to do this???
 
A

Allen Browne

Ctrl+semicolon inserts todays date (but not the time.)

You could write some code in the KeyDown event of the form to trap for the
special key, and insert the desired text at the cursor. There's an example
here:
Insert characters at the cursor
at:
http://allenbrowne.com/func-InsertChar.html

However, the best solution would be to create a related table of notes, so
people can add new notes at any date, and it's dead easy to track who added
what when. This table would have fields like this:
NoteID AutoNumber primary key
FKID relates to the primary key of your existing table
EnteredBy who inserted this note
NoteDateTime Date/Time When the note was entered.
TheNote Memo Content of the note.

The notes are entered into the subform (Continuous Form view, so you can see
several of them.) The NoteDateTime has a Default Value of =Now() so it
automatically records the date and time. To track who entered the note, you
could even use the name of the user who is logged into Windows:
http://www.mvps.org/access/api/api0008.htm
 
D

Daniel Pineault

Yes and No (don't you love answers like that). There is no built in shortcut
to do that, but you can easily, with a little vba, get it to behave like that
for you.

Here are the basics:
Using the KeyUp Event you can execute a simple routine that inserts the date.
Look in the help for more info on the key up event.
--
Hope this helps,

Daniel Pineault
For Access Tips and Examples: http://www.cardaconsultants.com/en/msaccess.php
If this post was helpful, please rate it by using the vote buttons.
 
C

Courtney

Found your response really helpful, Allen. I am completely new to Access (my
question will probably be evidence to that fact) and I have added a subform
to a form in order to record notes as you describe in your post. My problem
is that the subform is not unique to each record - that is, data that I enter
into the subform in the Record#1 also appears in the subform in the Record#2
and 3 and so on.

Is there a way to make the subform data unique to each record? Your post
makes me believe there is. If that is the case, would you (or anyone!)
please let me know how to do this? Thanks ever so much!!!

Courtney
 
J

John W. Vinson

Is there a way to make the subform data unique to each record? Your post
makes me believe there is. If that is the case, would you (or anyone!)
please let me know how to do this? Thanks ever so much!!!

Set the Subform's Master Link Field to the field in the main form's
recordsource that uniquely identifies a record, and the Child Link Field to
the corresponding foreign key field in the notes table.
 

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