By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,477 Members | 1,641 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,477 IT Pros & Developers. It's quick & easy.

How to make button filling in the present date in a data field

P: n/a
I have a field "Notes" and I would like to have a button in the
vicinity doing the following:

It goes to the end of the present text, already filled in the
Note-field, performs a [Return] and put in the present date.

NOTES-field:

text
text
text [return]
13-07-2005 new text

Nov 13 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
AA Arens wrote:
I have a field "Notes" and I would like to have a button in the
vicinity doing the following:

It goes to the end of the present text, already filled in the
Note-field, performs a [Return] and put in the present date.

NOTES-field:

text
text
text [return]
13-07-2005 new text


Me.Notes = Me.Notes & vbCrLf & Format(Date, "dd-mm-yyyy")

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Nov 13 '05 #2

P: n/a
Rick,

It works, how to also have the cursor positioned, after the button push
like 12-04-2005 |
Thank you.

Nov 13 '05 #3

P: n/a

AA Arens wrote:
Rick,

It works, how to also have the cursor positioned, after the button push
like 12-04-2005 |
Thank you.


To get what you show, add
& " "
to what Rick posted. Then use SelStart. Access drops trailing spaces
in textboxes but spaces added using code seem to stay.

James A. Fortune

Nov 13 '05 #4

P: n/a
James,

I am not so familiair with the VB script. Could you give me a push
toward it. I know how to access it, but not how to make the script for
this issue. I already took the Help but the explenation is not
sufficient.
Can it be put below the
Me.Notes = Me.Notes & vbCrLf & Format(Date, "dd-mm-yyyy")" " script?

Nov 13 '05 #5

P: n/a
Me.Notes = Me.Notes & vbCrLf & Format(Date, "dd-mm-yyyy") & " "

Nov 13 '05 #6

P: n/a
Just want to know how to also have the mouse pointer moved to the back
of the date appeared in the field.
My mousepointer is at the button at that moment.

Bart

Nov 13 '05 #7

P: n/a
AA Arens wrote:
Just want to know how to also have the mouse pointer moved to the back
of the date appeared in the field.
My mousepointer is at the button at that moment.

Bart


The formatted date plus added space makes 11 characters.

You'll need something like (air-code):

Me.Notes = Me.Notes & vbCrLf & Format(Date, "dd-mm-yyyy") & " "
Notes.SetFocus
Notes.SelStart = Len(Notes.Value) - 11

That should put the cursor at the beginning of the line containing the
date. Also, thanks to BillCo for answering your question when I wasn't
available.

James A. Fortune

Nov 13 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.