Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do i calculate the first day of month?

Status
Not open for further replies.

dwight1

IS-IT--Management
Aug 22, 2005
176
US
I have a start date field that i input date in it. I want to automate the field by identifying the start date which is equal to the first day of month.

Can anybody help?

Thanks

D
 
is this in your table? on a form before you run a query? where do you need this date?

Leslie

In an open world there's no need for windows and gates
 
Currently i am using the following formula (from this forum) to identify the week days in a month. I have modified the formula for end date to date(). I am currently entering the Start date field as part of the query execution. Not in table and not in form. If i could get to start date that is first of the month automated i do not have to change/enter dates anywhere.


(datediff("w",[start date], [end date]) * 5) +
(datediff("d",[start date], [end date])) mod 7 +
((datepart("w", [start date]) < datepart("w", [end date])) * 2)

The reason i am using this formula is to calculate number of sales completed current month. For example if the target for the month is 40 and we have 20 working days then each person has to complete atleast 2 sales multiplied by week days completed.

Hope i did not confue you.

Thanks for your help.

D

 
CDate(Month(Date())&"/01/"&Year(Date()))

This will give you

Month of today AND /01/ AND Year of today

and convert it to a date type.

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244. Basics at
 




The first day of the month, given any date...
Code:
dim dFirstDayOfMonth as date
dFirstDayOfMonth = dateserial(year([Any Date]), month([Any Date]),1)


Skip,
[sub]
[glasses] When a diminutive clarvoyant had disappeared from detention, headlines read...
Small Medium at Large[tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top