Results 1 to 6 of 6
  1. #1
    Join Date
    Dec 2010
    Posts
    3

    Unanswered: Date as default value but not in American Format

    Hello Everyone,

    I have got a datasheet form set up to take the date value from the previous record and use it as the default date in a new record. I have got this working fine except for the fact that the date defaults to the american date value rather than the european one.

    So for example if i select the date 11-april it will default the next one to 4-november as it reads the american format rather than the european one.

    The code in question:
    Code:
    Private Sub applDate_AfterUpdate()
    
    Me.applDate = Format("dd mmm yyyy")
    If Not IsNull(Me.applDate.Value) Then
    applDate.DefaultValue = "#" & Me.applDate & "#"
    
    End If
    End Sub

  2. #2
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6

  3. #3
    Join Date
    Dec 2010
    Posts
    3
    Sorry I am kinda new to this, and still can't figure it out from your links. Also, I realised that I left an extra line in the code I posted previously. What I should've posted:
    Code:
    Private Sub applDate_AfterUpdate()
    
    If Not IsNull(Me.applDate.Value) Then
    applDate.DefaultValue = "#" & Me.applDate & "#"
    
    End If
    End Sub

  4. #4
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    I've used a variation of the first method in applications used outside the US. In a standard module:

    Public Const conJetDate As String = "\#mm\/dd\/yyyy\#"

    In your code:

    applDate.DefaultValue = "#" & Format(Me.applDate, conJetDate) & "#"
    Paul

  5. #5
    Join Date
    Dec 2010
    Posts
    3
    Awesome thanks, that fixed my problem

  6. #6
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    Happy to help, and welcome to the site!
    Paul

Posting Permissions

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