Time field on Access does not display.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Bre035
    New Member
    • Sep 2007
    • 42

    Time field on Access does not display.

    The following is the code I am using in an attempt to add a Date and Time stamp to new records saved in main table. The date returns but the Time doesn't. I have tried various fixes like creating a TimerInterval text box with little look.

    Code:
    Private Sub Form_Load()
    'Form_frm_CLLDateEntry.Filter = "[tbl_CallData].Analyst" = Me.Text25
    'Form_frm_CLLDateEntry.FilterOn = True
    
    'strRacf = "Query_qry_getLoginID.RacfID"
    'Me.Text25.Value = strFacf
    
    Me.txtDate = DateValue(Now)
    Me.txtTime = TIME()
    Me.TimerInterval = 1000
    
    
    End Sub
    Last edited by missinglinq; Mar 24 '10, 11:08 PM. Reason: Please use Code tags when posting VBA code
  • missinglinq
    Recognized Expert Specialist
    • Nov 2006
    • 3533

    #2
    You're using the wrong event and you're not testing to see if it's a new record. This should do it:
    Code:
    Private Sub Form_Current()
     If Me.NewRecord Then
      Me.txtDate = Date
      Me.txtTime = Time
     End If
    End Sub
    This will populate your fields when a new record is started. If you want to Time Stamp to reflect when you finish and actually save the record, move the code to the Form_BeforeUpda te event, instead of Form_Current.

    Linq ;0)>

    Comment

    • Bre035
      New Member
      • Sep 2007
      • 42

      #3
      I will try in the morning on my form that is using a Select Query.

      Comment

      Working...