i have a module that runs daily, and, only on the second business day of the month, sets up a spreadsheet with a column for each working day in the month and saves that spreadsheet in the format
"Template" & Month(date) & Year(Date) & ".xls" (i.e. Template1208.xls).
Because the setup code only runs on the second business day of the month, it is nested within an If statement that determines whether that day is, in fact, the second business day of the month.
The code following the If statement looks up values from a query and fills in the correct data for each customer in the previous business day's column and saves and sends the spreadsheet, so that the data is cumulative. The users want the data stored within the spreadsheet so that it is accessible to them, so that an append query is not useful.
i need to be able to open the correct spreadsheet (i.e. Template1208.xls) and set the cell values each day. How can i store the name of the spreadsheet so that it can be seen on subsequent days? i can't simply use the Month(date) & Year(Date) code each day because sometimes months are "extended" beyond the last day of the actual month (for example, the working month of December this month is being extended through Jan 2, so that on Jan 5, the first business day of the month, i will be filling in information for Jan 2 as if Jan 2 falls within December). If i tried to use the Month(Date) & Year(Date) code, it would look for Template0109.xls unsuccessfully on Jan 5, or at best entering it in the wrong spreadsheet.
i hope this makes sense! i've tried creating a public variable and setting it in the monthly If statement, and i've tried creating an unbound object in the form with the command button that runs the code, but it doesn't remember the value the next time the form is opened. The form is already bound to a different table, so i can't bind that field very effectively.
Thanks!
"Template" & Month(date) & Year(Date) & ".xls" (i.e. Template1208.xls).
Because the setup code only runs on the second business day of the month, it is nested within an If statement that determines whether that day is, in fact, the second business day of the month.
The code following the If statement looks up values from a query and fills in the correct data for each customer in the previous business day's column and saves and sends the spreadsheet, so that the data is cumulative. The users want the data stored within the spreadsheet so that it is accessible to them, so that an append query is not useful.
i need to be able to open the correct spreadsheet (i.e. Template1208.xls) and set the cell values each day. How can i store the name of the spreadsheet so that it can be seen on subsequent days? i can't simply use the Month(date) & Year(Date) code each day because sometimes months are "extended" beyond the last day of the actual month (for example, the working month of December this month is being extended through Jan 2, so that on Jan 5, the first business day of the month, i will be filling in information for Jan 2 as if Jan 2 falls within December). If i tried to use the Month(Date) & Year(Date) code, it would look for Template0109.xls unsuccessfully on Jan 5, or at best entering it in the wrong spreadsheet.
i hope this makes sense! i've tried creating a public variable and setting it in the monthly If statement, and i've tried creating an unbound object in the form with the command button that runs the code, but it doesn't remember the value the next time the form is opened. The form is already bound to a different table, so i can't bind that field very effectively.
Thanks!