Results 1 to 7 of 7
  1. #1
    Join Date
    Jan 2009
    Posts
    7

    Unanswered: Help with writing code for an event procedure in Access 2003

    I am using Access 2003 and I have a form that has a staus combo box and a resolution_eta box. When I choose close from the status box, I want the current date and time to go into the resolution_eta box. I have written some of the code but it's not working. I'm still learning how to write the code.

    The code I have written is:

    Private Sub Status_Change()

    If Me![Status] = "Closed" Then
    Me![Resolution_ETA] = Now()

    End If


    End Sub

    The error is on the second line

    I have also put date instead of now but that also gives me an error.
    Can anybody help please.
    Last edited by kathhear; 10-12-09 at 20:19. Reason: I didn't put enough information in.

  2. #2
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Be good if you could post the code you have. It would certainly make it easier.

    What data type does resolution_eta take? Is it a date/time or a text field?
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  3. #3
    Join Date
    Jan 2009
    Posts
    7
    Hi

    It's a date/time field and I have updated my query.

    Thanks

  4. #4
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Usually it helps to know what the actual error is when diagnosing the error...

    Given absolutely no information and a vague allusion to erroring when calling Now(), I'd say check your VBA references.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  5. #5
    Join Date
    Jan 2009
    Posts
    7
    Yes I am being vague because I don't know what else to say.

    This is the error message when I clicked on Closed in the Status box

    Run-time error '438':
    Object doesn't support this property or method.

    END DEBUG

    When I click on Debug it goes back to the code and highlights this line

    ME![Resolution_ETA]=Now()

    Does this make more sense to you?

    Thanks

  6. #6
    Join Date
    Aug 2003
    Location
    Bulgaria, Plovdiv
    Posts
    36
    Check this

    Me![Resolution_ETA]=Format(DateSerial(Year(Date), Month(Date),Day(Date)), "Short Date")

  7. #7
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Try this:

    Me.Resolution_ETA = Now()

    IF the Resolution_ETA is connected to a date/time field and

    MsgBox Now()

    works, then check the Name property of the form field you think is Resolution_ETA and adjust it to Resolution_ETA.

    I wonder if it's one of those "auto created" underscores that Access gives in code when you have spaces or strange characters in object names.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

Posting Permissions

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