Question : Access 2000: Changing the Pagesize of a Report at runtime

Hi

I don't think this is possible but its worth an ask anyway.  Is it possible to change the Pagesize of a Report from A4 to Letter and back without going into Design mode.  I need to be able to do this on a Windows 2000 Server machine that only has the Access 2000 runtime installed.

Thanks



Stuart

Answer : Access 2000: Changing the Pagesize of a Report at runtime

Yes, it is.  Not directly in Access VBA however.

1. Open up the Printing Preferences from Windows (not in Access) and set the settings you want for one setting.
2. In Run type:
    rundll32 printui.dll,PrintUIEntry /Ss /n "the printer name in quotes" /a "the path and name of a file to store the settings in quotes" u
    Example:  rundll32 printui.dll,PrintUIEntry /Ss /n "Okipage 10I" /a "C:\FolderA\OkiA4.ptr" u
    This will create a file with the settings you want.
3. In VBA code before the print command put:
     rundll32 printui.dll,PrintUIEntry /Sr /n "the printer name in quotes" /a "the path and name of a file to store the settings in quotes" u
    Example:  rundll32 printui.dll,PrintUIEntry /Sr /n "Okipage 10I" /a "C:\FolderA\OkiA4.ptr" u

Don't forget the "u" on the end or it will not work for anyone with less than Power User privledges.

This will change the settings for the printer for all applications on the computer so you would also want to save the printer settings to a file (with the /Ss switch) before changing it; then change it back to the original settings.

In my database, I have a form called Printer Settings where I can store the printer and its settings for every printing event in my database and a module that handles all the printer changes.  If you would like a copy of that, let me know.  I will pull it out, create a new demo db with just that in it and post it somewhere for you.

Random Solutions  
 
programming4us programming4us