What's wrong with this SQL for Date?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • MNNovice
    Contributor
    • Aug 2008
    • 418

    What's wrong with this SQL for Date?

    My form has two text boxes, txtDateFrom and txtDateTo. A macro button with the caption Month is to automatically fill in txtDateFrom and txtDateTo with current month date. My code reads as:

    Code:
    Private Sub cmdmonth_Click() 
    
    'Sets the Date From and Date To text boxes 
    'to show complete month (from start to end of current month) 
    	  
        Me!txtdatefrom = DateAdd("m", (today * -1), Date) 
        Me!txtDateTo = DateAdd("d", -1, DateAdd("m", 1, Me!txtdatefrom)) 
      
    End Sub
    what I want is this: 5/1/2009 -5/31/2009 but what I get is 5/15/2009 - 6/14/2009How can I modify this code to get This month instead of a month from today?

    Thanks.
  • Denburt
    Recognized Expert Top Contributor
    • Mar 2007
    • 1356

    #2
    I posted in the other Thread.


    Is this a double post? If it is do you mind if I remove this one? If this isnt a duplicate please let me know so I can adjust the title as needed.

    Comment

    • IT Couple
      New Member
      • May 2009
      • 36

      #3
      Seem to be a double post..... again I think format function might help ;)

      Regards
      Emil

      Comment

      • Denburt
        Recognized Expert Top Contributor
        • Mar 2007
        • 1356

        #4
        ok I am going to lock this one for now M if you don't feel this is a double post please P.M. me or another moderator with your reasoning if you would like this one unlocked.

        Comment

        Working...