Event Proceedure on Dbl Click

Designer156

Registered User.
Local time
Yesterday, 16:16
Joined
Aug 31, 2007
Messages
12
Guys,

I've done it before, but can't remember how..I want to automatically insert the current date into a control on a form by double clicking it. I understand i need to select event proceedure and then add some code that includes '=date()' but what else?

Thanks
 
How bout
On DoubleClick
Me.Fieldname = Date
 
What would be the correct syntax, given that the control name is 'Completed_Date' and the Form is called 'Opportunity' ??

All I have right now is:

Code:
Private Sub Completed_Date_DblClick(Cancel As Integer)

End Sub
 
Private Sub Completed_Date_DblClick(Cancel As Integer)

Me.Completed_Date = Date

End Sub

But I would change the name of your textbox from "Completed Date" to "CompletedDate" drop the space. Or if you want to be REALLY correct... "dtmCompletedDate" The "Me." references your form "Opportunity", you can change it to "frmOpportunity".
 
Hi, This is an old post of mine and it worked well, but now I need to improve it a bit...

If I have a blank file dand I double click in it it inserts the current date, but if the field already has data, it overwrites the current data with the date.

How can I modify the code to add the date to the end of the current info.

Thanks in advance!
 
If I understand you request correctly try...

Me.Fieldname = Me.Fieldname & Date

Garry
 
I would think about why you are changing the date. If the original date is for historical reasons I would add another field. Plus, if you ever want to use your dates as criteria for filtering records.... how is that going to work?
 
This is for a notes field about a customer. When I call them I want to just double click and add some notes baout the call in the same field as the rest
 
If I understand you request correctly try...

Me.Fieldname = Me.Fieldname & Date

Garry

That does the job! Thanks!

One more thing, how can I add a carriage return before the new date?
 
Actually, I've discovered how to add the carriage return:
Code:
Private Sub Notes_DblClick(Cancel As Integer)
Me.Notes = Me.Notes & vbCrLf & vbCrLf & Date
End Sub

Now I just want to add a space after the date
 
Ok, got it cracked...
Code:
Private Sub Notes_DblClick(Cancel As Integer)
Me.Notes = Me.Notes & vbCrLf & vbCrLf & Date & " - "
End Sub

Thanks!!
 

Users who are viewing this thread

Back
Top Bottom