By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,968 Members | 1,180 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,968 IT Pros & Developers. It's quick & easy.

What's wrong with this SQL for Date?

100+
P: 418
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:

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdmonth_Click() 
  2.  
  3. 'Sets the Date From and Date To text boxes 
  4. 'to show complete month (from start to end of current month) 
  5.  
  6.     Me!txtdatefrom = DateAdd("m", (today * -1), Date) 
  7.     Me!txtDateTo = DateAdd("d", -1, DateAdd("m", 1, Me!txtdatefrom)) 
  8.  
  9. 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.
May 15 '09 #1
Share this Question
Share on Google+
3 Replies


Denburt
Expert 100+
P: 1,356
I posted in the other Thread.
http://bytes.com/topic/access/answer...te#post3488017

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.
May 15 '09 #2

P: 36
Seem to be a double post..... again I think format function might help ;)

Regards
Emil
May 15 '09 #3

Denburt
Expert 100+
P: 1,356
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.
May 15 '09 #4

This discussion thread is closed

Replies have been disabled for this discussion.