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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

NEED LAST MONTHS RECORDS

Status
Not open for further replies.

tonyjohn

Programmer
Oct 11, 2000
1
CA
I need to grab all my rows that contain a finished task from a previous month. I generate an invoice each month and the invoice must only contain projects with last months comnpleted tasks. [sig][/sig]
 
This may be totally out. But I guess you have a column that flags if the task is complete or not and you must have a date column. So you can select all the completed tasks for the last month, using datediff() with the date column and date(). [sig][/sig]
 
By using date functions, you can determine what the last day of the previous month is...or for that matter you can determine what the previous month was and current year for that month. I will post tommorrow the code to determine the last day of the previous month. You can look at the previous month using the datepart function to look at the month -1 and (note you will need logic to look at the 12 for the month if the current month is the first.) I will post all the code tommorrow. The other way you could do this is to have user input param. to pass the month and year. I am programming a GL SAP Interface for Accounting where we are pulling all transactions for the previous month that need to be posted. My users are going to be responsible for passing the Month and year. Then with code I will set the start date to the 1st of the month and then determine what the last day of the month is. After I post the code tommorrow it will make more sense...but you can do this it is a little tricky, but i can be done. You just have to be creative with the date functions.
[sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top