Results 1 to 3 of 3
  1. #1
    5 Star Lounger bfxtrfcmgr's Avatar
    Join Date
    Aug 2002
    Location
    Fresno, California, USA
    Posts
    995
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Capture Date/Time (2003)

    In the attached db, the Order Status combo (frmOrder_Detail) is supposed to capture the current date and time and log it into the table. The command button then opens a form to reveal the log. In the original db (to large to attach) I got half of the status' to work, but some did not. That has driven me nuts for the last five hours because I can't figure out why some work, but not others. In the attached db none of them work, but I used the same code and tables.

    Once again, any help greatly appreciated.
    Bryan,
    Not the smartest critter on the glacier. . .
    . . .but I'm persistent (does that count?)

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Capture Date/Time (2003)

    Say you select AR in the combo box. The line

    Me(Me.cboOrderStatus.Value & "Date") = Date

    attempts to set the field ARDate to the current date. But there is no field named ARDate, as you can verify by looking at your table in design view. There is a field dtmARDate. If you meant to set that, you should use

    Private Sub cboOrderStatus_AfterUpdate()
    Me("dtm" & Me.cboOrderStatus.Value & "Date") = Date
    Me("dtm" & Me.cboOrderStatus.Value & "Time") = Time
    End Sub

    Private Sub cboOrderStatus_BeforeUpdate(Cancel As Integer)
    If Not IsNull(Me("dtm" & Me.cboOrderStatus.Value & "Date")) Then
    MsgBox ("This status has already been logged. Press 'Esc' twice,") & vbCrLf & _
    ("'Tab', and click 'View Order Status Log' to edit existing entry.")
    Cancel = True
    End If
    End Sub

  3. #3
    5 Star Lounger bfxtrfcmgr's Avatar
    Join Date
    Aug 2002
    Location
    Fresno, California, USA
    Posts
    995
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Re: Capture Date/Time (2003)

    Hans:

    Find and Replace is a great tool if you're very careful with it. I totally forgot about "standardizing" some naming rules the other day, and while F&R does a good job, it couldn't have corrected this code issue. I don't know how many times I looked at that table to make sure the entries were there, but somehow never got the fact that I had changed them all to dtm...

    I'll go back to my cave now, with many thanks for your always kind and generous help. You da man!!
    Bryan,
    Not the smartest critter on the glacier. . .
    . . .but I'm persistent (does that count?)

Posting Permissions

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