Default property for a control bounded to a Date/Time field

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Mihail
    Contributor
    • Apr 2011
    • 759

    Default property for a control bounded to a Date/Time field

    The original question is located here (AWF)
    I'll repeat here if needed.
    Have you a solution for this ?

    Thank you !
  • zmbd
    Recognized Expert Moderator Expert
    • Mar 2012
    • 5501

    #2
    Mihail:
    In the cross posted thread it is "asked and answered"

    So it would be helpfull for you to restate the question.
    I noticed in the cross-post that there was a little confusion about what you were/are after; thus, by restating/rephrasing the question a fresh view might be established.

    As for what I've been able to follow, from this link: Set default values for fields or controls (ACC2007/2010) you should be able do what you ask about.

    So, re-phrase, show your work (^-^), and as usual we'll give it the best effort

    Comment

    • Mihail
      Contributor
      • Apr 2011
      • 759

      #3
      Hi, zmbd.

      I ask here because, at that time I have had no answer in AWF.
      Now the thread in AWF is SOLVED.
      I have the solution, thanks to namliam.

      The solution is:
      Code:
      'In the form module
      Private Sub DataComanda_AfterUpdate()
          Me.DataComanda.DefaultValue = EnglishDate2(Me.DataComanda)
      End Sub
      
      'and in a regular module:
      
      Public Function EnglishDate2(UzualData) As Double
      Dim dt As Date
          dt = Month(UzualData) & "/" & Day(UzualData) & "/" & Year(UzualData)
          EnglishDate2 = CDbl(dt)
      End Function
      If someone will have a better one will be welcoming.

      Comment

      • Mihail
        Contributor
        • Apr 2011
        • 759

        #4
        @zmbd
        As you can see is not a breeze.
        Never mind that, in this case, is necessary to convert date to double.
        And still I don't understand why/how Microsoft don't implemented a simple way.

        Comment

        • zmbd
          Recognized Expert Moderator Expert
          • Mar 2012
          • 5501

          #5
          Glad it worked out for you. Looks a lot like what I though it might; however, I wasn't entirely sure of what you were after from the crosspost.

          ... and if you ever figure out why MS decides to make things as complicated as they do... you will be very rich indeed when you publish. };-)

          Comment

          Working...