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]