Overriding a Date/Time stamp, and then Resetting it

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • 6afraidbecause789@gmail.com

    Overriding a Date/Time stamp, and then Resetting it

    Hi - I am using a Date/Time Picker popup form for users to choose a a
    date and time for use on a separate entry form. The date/time on the
    entry form is actually entered automatically as a date/time stamp when
    a user enters a record. So, the popup form is only necessary when a
    user needs to change the date/time.

    To make this more user-friendly...ther e will be times when a user will
    be away from the computer, and therefore, will have to later enter a
    bunch of back-dated records in one sitting. When a user picks an
    older date/time from the picker, is there a way to temporarily store
    that value and use it for all the new records he/she enters in that
    sitting; while the entry form is open (single form view). Then, if
    the user closes and reopens the form, or simply clicks a button
    somewhere to reset the date/time, the date/time stamp would be reset
    to the machine's current date/time.

    I hope this makes sense.
    Thank you.
  • 6afraidbecause789@gmail.com

    #2
    Re: Overriding a Date/Time stamp, and then Resetting it

    I'm posting a solution to my own problem--just one way I suppose...

    In the subform that contains the date & time stamp field, I added an
    unbound textbox named txtDate to store a separate, hidden date value
    with the default value of Now(). If the user double-clicks on the
    regular date/time field named InterventionDat eTime and picks an
    earlier date from the popup mini date/time picker, then this will
    occur on the beforeupdate of the subform:

    If Me.txtDate Me.Intervention DateTime Then
    If MsgBox("Do you want to use this 'past' date as the" & Chr(13) +
    Chr(10) _
    & "default date for new interventions entered this session?", vbYesNo)
    = vbYes Then
    InterventionDat eTime.DefaultVa lue = "#" & InterventionDat eTime & "#"
    Me.Parent.cmdRe setDateTime.Vis ible = True
    Else
    InterventionDat eTime.DefaultVa lue = "#" & Now() & "#"
    End If
    End If

    On the main form, I added a cmdbutton named cmdResetDateTim e that,
    when clicked, will reset the date to "#" & Now() & "#".

    Lastly, on the mainform's open event, I also reset the default value
    of the subform's date field to "#" & Now() & "#".

    Comment

    Working...