I have a parameter form which I use to select a value to filter a report. This form used the procedure (rptPhoneBook example) from Access 2000 Developer’s handbook, one of the features of which is that it uses a constant for the report name and calls on the constant to open the report.
I now have two slightly different reports that I want to be able to use the same form for choosing values and an added field for choosing which report to print. One is for local use and the other with less detail for submission to the regional body. I discovered in the course of working through this that constants (of which I had given little thought previously), are just that, constant and can’t be changed on the fly. I created a workaround by getting rid of the constant and using a function with the same name as the constant to call the report name. This meant I didn’t really have to rewrite anything and only had to create a very simple function.
So, here’s the question: Is there a more efficient way to do this? I noticed that the function gets called several times in the process. Is there a way to get the name stored for the duration of the various procedures and not called each time the next little procedure is run? It doesn’t seem to slow things down appreciably it’s more a question of is this the best way to do it.