Unanswered: Enter Date Automatically on Double Click
I am very new to access 2007.
I have recently created a schedule for a manufacturing floor. I have created a form where the employees have to enter the date and time that they start a process. I would like the employees to be able to double click on the feild and have access populate the date and time for them.
I was able to make this work in access 2003 by using the following:
Private Sub BP_ASSY_START_DblClick(Cancel As Integer)
Me.BP_ASSY_START.Value = Now()
This does not work in 2007. In 07 it gives me the date box to select a date, but then does not fill in the time. Does anybody have any sugestions?
Have you tried to debug it? Is the event firing properly? If it's getting assigned properly that it's probably a formatting issue, in which case I would suggest having a look at the format property of the textbox and make sure it's set to show a date and a time (not just "short date" or something).
Start with that and let us know if that get's you what you want or if you need more. Cheers!
i had it on some forms, when the text box was dbl clicked it set the 'recordsource' to Date, ie instead of setting the value of textboxASSY_START to the date i set the actual table column [ASSY_START] to date. perhaps try something like that.
I'm working with Access 2010 and don't know much code. I have a form with numerous data fields, and I would like the operator to just click in the field and it will populate with the current date and time. I've been told to enter the following code in the "on click" of the field's property sheet - Me.SignOff = Date() When I do that and then click in the field, I get the error message - "Microsoft Access cannot find the object 'Me.' If 'Me.' is a new macro or macro group, make sure you have saved it and that you have typed its name correctly." Any ideas on how to solve this??
Are you entering the data in the visual basic screen? It sounds like you may just be typing it in the property field next to the On Dbl Click property.
When I entered this code, I did it in two property fields. (put you cursor in the field and click the box with three dots in it. Then click on event procedure to enter code).
1. In the forms on current property, you would need to insert the following:
If IsNull(SignOff) Then
SignOff.Locked = False
SignOff.Locked = True
2. In the SignOff fields On Dbl Click property insert the following code:
Private Sub SignOff_DblClick(Cancel As Integer)
If IsNull(SignOff) Then
Me.SignOff.Value = Date()
This will make it so that the operator double clicks to enter the date and after he/she tabs to a new record the record will be locked. (to change the value, you just have to go into the main table and delete the information entered).
I am pretty novice at all of this too, but this code works well. If you change the Date() to Now() it will also insert the time that they clicked the field.