Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2004
    Posts
    16

    Unanswered: problem with date

    Hi,

    I have a problem with a field in a form. I would like this field to store a date as a default value just after the user types it. So the procedure looks like:

    Private Sub date_AfterUpdate()
    Me.date.DefaultValue = Me.date.value
    End Sub

    After changing the field date and saving a record the field gets a strange value - for example user types 2004-07-19 and the default value is something like 1905-05-31 instead of 2004-07-19.

    If anybody could help...

    Thanks,
    Pawel

  2. #2
    Join Date
    Jan 2004
    Location
    Vancouver, WA
    Posts
    41
    Two things:
    1. Make sure the underlying data type for the bound field is Date.
    2. Check the Format property and set it to display as desired ("mm/dd/yyyy" for 07/19/2004).

  3. #3
    Join Date
    Mar 2004
    Posts
    16
    I've got the answer. It must be:

    Private Sub date_AfterUpdate()
    Me.date.DefaultValue = "#" & Me.date.value & "#"
    End Sub

    instead of the earlier version.

    Thanks,
    Pawel

Posting Permissions

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