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

Change BackColor for Print Screen 1

Status
Not open for further replies.

charcurley

Programmer
Aug 16, 2001
29
0
0
I have a Main Screen with many sub forms. When it prints the text boxes are all gray and the print out uses quite a bit of ink. I want to change the backcolor for the print out. I am now using code:

PreviousColor = 12632256

Me.Section(acDetail).BackColor = vbWhite
Me.Label322.BackColor = vbWhite

then

docmd.printout

and finally

Me.Section(acDetial).BackColor = PreviousColor...

and so on with the different sub form and labels. There has to be a way to update all of the text boxes but I am stuck. Any help would be appreciated.
 
The DoCmd.Printout Action prints the Form the way it is set up. The only way around it that I know of is to do what you are doing...save the previous color settings, change them for the printout, and then set them back. If you don't want to do this, you could create a Report to print the data instead of using DoCmd.Printout.

dz
dzaccess@yahoo.com
 
By the way, if you want to use DoCmd.Printout, it would probably be easier to use the following code to cycle through all the text boxes and labels on the form than to hard code each of your control names.

Code:
Dim ctrl As Control

For Each ctrl In Me.Controls
    If ctrl.ControlType = acTextBox Or ctrl.ControlType = acLabel Then
        ctrl.BackColor = vbWhite
    End If
Next


dz
dzaccess@yahoo.com
 
For more samples of control looping, you should be able to find something through a search here, and for instance faq702-5010.

Roy-Vidar
 
DZ,
Thanks! Exactly what I was looking for my mind just went blank.
Regards,
C
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top