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

formatting contols

Status
Not open for further replies.

bronc

Instructor
Aug 28, 2003
145
GB
I want to format lots of text boxes which are already on my form to .423 height and Font Tahoma size 8. The format painter does the height only. Is there a way - maybe from code (but presumably in design view) of applying formatting in one go to text boxes for example that I place on the form. It would be helpful to be able to select the control first I guess. Thanks.
 

Hold down Ctrl key on your keyboard and select multiple text boxes. This way you can change property to all of them in one go.

Have fun.

---- Andy
 
thanks for your - I would have liked to code something but that should keep me busy for the moment.
 
I'm not sure why you would want to do this with code unless you have lots of forms with lots of controls. You could use code like the following (with added comments and error handling):
Code:
Public Function SetControlFormats(strFormName As String) As Boolean
    Dim frm As Form
    Dim ctl As Control
    DoCmd.OpenForm strFormName, acDesign, , , , acHidden
    Set frm = Forms(strFormName)
    For Each ctl In frm.Controls
        If TypeOf ctl Is TextBox Then
            ctl.Height = 0.423 * 1440
            ctl.FontName = "Tahoma"
            ctl.FontSize = 8
            Debug.Print ctl.Name & ", " & ctl.ControlSource
        End If
    Next
    DoCmd.Close acForm, strFormName, acSaveYes
    
End Function

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top