UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Auto Date In Field, Office 2010    
 
   
dbrmdlorim
post May 5 2012, 08:05 AM
Post #1

UtterAccess Addict
Posts: 224



I have a form I use to enter info to a form. I return to this form every 5-6 months I note the condition of the piano each time I work on it I would like to date/time stamp my notes entry. Is there a way to insert date time into a field on a form, that reports to a table, by pushing a function key. I would like to push say "f4" and have the date time populated then type my notes in the memo field.
Go to the top of the page
 
+
missinglinq
post May 5 2012, 08:17 AM
Post #2

UtterAccess Ruler
Posts: 2,655



There already exists an Access Shortcut to do this:

<Ctrl> + <;>

Would that suffice or does it have to be one-key deal?

To re-assign the F4 Key, code like this

You must set the Form's KeyPreview Property to YES!

CODE
Private Sub form_keydown(KeyCode As Integer, Shift As Integer)

Select Case KeyCode
  Case vbKeyF4
    MemoField.SetFocus
    Me.MemoField = Me.MemoField.Text & " " & Date & " "
    Me.MemoField.SelStart = Len(Me.MemoField)
    KeyCode = 0
End Select

End Sub


You'll need to replace MemoField with the actual name of your Textbox, of course.

Also, be careful in choosing an F Key to re-assign; its native Access function will be cancelled.


Linq ;0)>

This post has been edited by missinglinq: May 5 2012, 08:40 AM
Go to the top of the page
 
+
dbrmdlorim
post May 5 2012, 10:16 PM
Post #3

UtterAccess Addict
Posts: 224



cntrl : will work just fine Thanks
Go to the top of the page
 
+
missinglinq
post May 6 2012, 08:24 AM
Post #4

UtterAccess Ruler
Posts: 2,655



Glad we could help!

Linq ;0)>
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 19th May 2013 - 08:17 AM