A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

1st Of Every Month



 
 
Thread Tools Display Modes
  #1  
Old November 21st, 2006, 12:13 AM posted to microsoft.public.access.queries
Jose Aleman
external usenet poster
 
Posts: 4
Default 1st Of Every Month

Hi,

I'm trying to build a query that gives me the first day of the current
month. This is what I currently have:

When I run my query it returns 10/1/06 and I want 11/1/06
DateAdd("m",-1,Date()-Day(Date()))+1

I try using the same concept as I use in SQL2K but it did not work. This is
what I use for SQL2K and it work like a charm but I'm not really familiar
with access.
convert(varchar,DATEADD(mm, DATEDIFF(mm,0,getdate()), 0),101) as data_date

Please help

Thanks

  #2  
Old November 21st, 2006, 12:24 AM posted to microsoft.public.access.queries
Jose Aleman
external usenet poster
 
Posts: 4
Default 1st Of Every Month

OK I got it...

I had to break the function in two.
DateAdd("m",0,Date())-Day(Date())


"Jose Aleman" wrote:

Hi,

I'm trying to build a query that gives me the first day of the current
month. This is what I currently have:

When I run my query it returns 10/1/06 and I want 11/1/06
DateAdd("m",-1,Date()-Day(Date()))+1

I try using the same concept as I use in SQL2K but it did not work. This is
what I use for SQL2K and it work like a charm but I'm not really familiar
with access.
convert(varchar,DATEADD(mm, DATEDIFF(mm,0,getdate()), 0),101) as data_date

Please help

Thanks

  #3  
Old November 21st, 2006, 12:54 AM posted to microsoft.public.access.queries
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default 1st Of Every Month

Jose

Another approach would be:

DateSerial(Year(Date()), Month(Date()), 1)

Regards

Jeff Boyce
Microsoft Office/Access MVP


"Jose Aleman" wrote in message
...
Hi,

I'm trying to build a query that gives me the first day of the current
month. This is what I currently have:

When I run my query it returns 10/1/06 and I want 11/1/06
DateAdd("m",-1,Date()-Day(Date()))+1

I try using the same concept as I use in SQL2K but it did not work. This
is
what I use for SQL2K and it work like a charm but I'm not really familiar
with access.
convert(varchar,DATEADD(mm, DATEDIFF(mm,0,getdate()), 0),101) as data_date

Please help

Thanks



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:22 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.