Results 1 to 7 of 7
  1. #1
    Join Date
    Aug 2009
    Posts
    61

    Unanswered: Enter Date Automatically on Double Click

    Hi There,

    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()
    End Sub

    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?

    Thanks

    MB

  2. #2
    Join Date
    May 2005
    Posts
    1,191
    Welcome to the forums.

    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!
    Me.Geek = True

  3. #3
    Join Date
    Feb 2006
    Posts
    60
    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.

  4. #4
    Join Date
    Aug 2009
    Posts
    10

    Enter date on click

    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??

  5. #5
    Join Date
    Aug 2009
    Posts
    61
    Hi kstarlin,

    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
    Else
    SignOff.Locked = True
    End If
    End Sub

    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()
    End If
    End Sub

    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.

  6. #6
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14

  7. #7
    Join Date
    Aug 2009
    Posts
    10

    Smile

    MBSmith

    Thank you so much, that worked great...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •