Form Style

A

Arvin Meyer [MVP]

EGG said:
Is there a way to change the background style of a form once it is
created?

Sure, open the form in design view. Open the property sheet and change the
Picture property of the form or, to change the color, click on each section
and change it. You can do them all at once by changing the following code to
your need:

Public Sub SetBackColor()
' Arvin Meyer 11/1/2007
On Error GoTo Error_Handler

Dim doc As DAO.Document
Dim db As DAO.Database
Dim frm As Form
'Dim ctr As DAO.Containers

Set db = CurrentDb
'Set ctr = db.Containers!Forms

For Each doc In db.Containers("Forms").Documents
DoCmd.OpenForm doc.Name, acDesign
Set frm = Forms(doc.Name)
frm.Picture = "(none)"
On Error Resume Next
frm.Section(0).BackColor = 16777215
frm.Section(1).BackColor = 16777215
frm.Section(2).BackColor = 16777215
DoEvents
DoCmd.Close acForm, doc.Name, acSaveYes
Next

Exit_Here:
'Set ctr = Nothing
Set doc = Nothing
Set db = Nothing
Exit Sub

Error_Handler:
MsgBox Err.Number & ": " & Err.Description, vbOKOnly, "Error"
Resume Exit_Here

End Sub
 
E

EGG

I made the form using the Access Wizard and want to pick a different
background style. I'm not sure how to do the recoding
 
A

Arvin Meyer [MVP]

There is no "recording" in Access, except maybe the recording of data. Paste
the code I posted into a standard module, and save it with a name like
basUtilities (anything but the same name as the procedure)

If you want to use a picture, put the path in place of the word none of the
code and comment out the section code. If you want a color instead, get the
color you want from the color property of one form that you've manually
changed, and put that color in place of 16777215.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top