Results 1 to 8 of 8
  1. #1
    Join Date
    Oct 2003
    Location
    Chicago, IL
    Posts
    154

    Unanswered: I feel silly asking but...

    I'm trying to update a field with the current date...

    Say I have a combo box [status] and when the user selects the value "completed" from the list, I would like to have another field [date hc completed] reflect the current date.

    here is what I have for the event procedure on field#1:

    Private Sub Combo551_AfterUpdate()

    If [Status] = "Completed" Then
    [Closed Issue].Value = True
    [DATE HC COMPLETED] = Format(Date, "Short Date")
    End If

    End Sub

    FYI, [date hc completed] is formatted mm/dd/yyyy with an input mask of 99/99/0000;0;_

    thanks a bunch!

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    [DATE HC COMPLETED].Value = Format(Now, "mm/dd/yyyy")

  3. #3
    Join Date
    Oct 2003
    Location
    Chicago, IL
    Posts
    154
    Maaahvelous! Thank you.

    Now, the only problem is that the field [date hc completed] does not reflect the change until i either click on it or exit the record.

    I tried RepaintObject (i found it in help) with no success.

    Any way I can make the change apparent immediately?

    Thanks

  4. #4
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Me.ReQuery

  5. #5
    Join Date
    Oct 2003
    Location
    Chicago, IL
    Posts
    154
    Close but no cigar!

    the query is based on items that are open and if i use that me.requery command, the record is no longer a part of that query and therefore disappears immediately!

    I was hoping to find a command that would just refresh the [date hc completed] field without fully updating the record yet.

    muchos gracias

  6. #6
    Join Date
    Mar 2003
    Location
    Bogota
    Posts
    67
    rather than using

    [DATE HC COMPLETED] = Format(Date, "Short Date")

    try refering explicitly to the text box on the form

    [DATE HC COMPLETED] could refer to the recordsource, not the text box.

    So, rename the text box txtDateHCCompleted or something, and then use:

    txtDateHCCompleted = Format(Date, "Short Date")

    I always name my text boxes different than the control source, for just this reason.

  7. #7
    Join Date
    Oct 2003
    Location
    Chicago, IL
    Posts
    154
    Actually, the [DATE HC COMPLETED].Value = Format(Now, "mm/dd/yyyy") works perfectly to post the correct information into the field.

    The only problem is that it doesn't immediately display and so the user might accidentally change the form...

    hmmm. maybe i will just take the [date hc completed] field off the form since they are not going to be filling the field anyway?

    hmmm

    thanks for all your helps!

  8. #8
    Join Date
    Mar 2003
    Location
    Bogota
    Posts
    67
    whatever

Posting Permissions

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