command button

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do I make a command button place a time/date stamp in a text box each time I click it
I have the command button placed next to a text box, but I can't seem to make it do what I want it to do
Can anyone help.
 
1. Set the On Click property ot the command button to:
[Event Procedure]

2. Click the Build button (...) beside this. Access opens the code window.

3. Enter this line in the sub:

Private Sub cmdDate_Click()
Me.[NameOfYourDateFieldHere] = Now()
End Sub

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Mike said:
How do I make a command button place a time/date stamp in a text box each time I click it?
I have the command button placed next to a text box, but I can't seem to
make it do what I want it to do.
 
Thank you for your imput. It worked great, but I need it to do more. I need it to, I guess start a new record also. When I click the button it places it in the text box. However, I need it to place it in the box each time I click it. I am trying to make a note system for when people to call. I will push the button and type what our conversation is. Then if they call tomorrow I will need to time/date stamp it again, but within the same text box. This is so my staff can look up a chart and see all of the conversations together.
 
There is a command button wizard to move you to a new record, or use this
code:
RunCommand acCmdRecordsGotoNew

To insert the date and time when the new record was created, just set the
Default Value property of the text box to:
=Now()

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

mike said:
Thank you for your imput. It worked great, but I need it to do more. I
need it to, I guess start a new record also. When I click the button it
places it in the text box. However, I need it to place it in the box each
time I click it. I am trying to make a note system for when people to call.
I will push the button and type what our conversation is. Then if they call
tomorrow I will need to time/date stamp it again, but within the same text
box. This is so my staff can look up a chart and see all of the
conversations together.
 
PMFJI, but aside from the dubious design of your encounters tracking, you
could simply use code to append the DTS to what I am assuming is a memo
field containing your notes.

Private Sub Command1_Click()

With Me.MemoField
.SetFocus
.Text = .Text & vbCrLf & vbCrLf & Now
.SelStart = Len(.Text)
.SelLength = 0
End With

End Sub



Mike said:
I don't want it to create a new record. I want it to go to a new line in
the same record. It should look like this if this is a text box.
5/24/2004 11:06:29 AM
Called and left message

5/24/2004 11:16:29 AM
Cheryl returned my message. Stating that I will make a payment

6/24/2004 11:06:29 AM
Called Cheryl reguarding non payment, told her I would have to send it to collections.

This would all be in one record for the same person. I have made a form
with tabs. The first page is the customer and the second page is the notes
for any correspondances.
 
Back
Top