Consulting

Results 1 to 4 of 4

Thread: VBA Date problem

  1. #1
    VBAX Newbie
    Joined
    Mar 2013
    Posts
    3
    Location

    VBA Date problem

    Hi,
    I am new to this forum, and a novice VBA user. And would welcome help with this little problem.

    I have two different forms that have a similar date requirement - I would like the current date entered into a field. This should be very simple, in oone form it works fine, in the other form it returns "Runtime Error 438" "object doesn't support this property or method".

    The code is absolutely identical in both forms -

    Dim dteToday As String

    dteToday = Format(Date, "dd/mm/yyyy")
    Me.tempDate = dteToday

    Anyone have any idea's what I am doing wrong?

    Thanks

  2. #2
    VBAX Contributor
    Joined
    Oct 2012
    Location
    Brisbane, Queensland, Australia
    Posts
    163
    Location
    Where the error occurs, is the field 9n the table\query expecting text or a date?

    If it's a date field, it won't accept a string.

  3. #3
    VBAX Newbie
    Joined
    Mar 2013
    Posts
    3
    Location
    Hi Doug,
    Thanks for your response.
    In both cases the date field is of "short date" format. I have had no problems feeding text strings to date fields.
    However if I rem out the Me.tempDate = dteToday it still returns the error, also if changing the field to a text field.

    Very strange!

    Gary

  4. #4
    I would try setting the filed that you are trying to pass the date into to General date and then try running the code that you have posted.

Posting Permissions

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