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

MickeyFinn (Programmer) Aug 26, 200

Status
Not open for further replies.

MickeyFinn

Programmer
Joined
Aug 26, 2002
Messages
2
Location
CA
MickeyFinn (Programmer) Aug 26, 2002
I am customizing a database for use by several companies.
I would like to specify the companies colour in a table, and have all the forms pick up on on that single color.

I've always create forms the getgo, applied a colour or design and poof!

This time around I'e injured my back and can't sit at the computer for more that 5 minutes at a time.

In the control of the form/design view the color palette is displayed when I attempt to change the colour in design view.

Guess I dig out the books,

Thanks
k'

 
well, if you are tring to change the background of a bound form, i would use the on current event, and based on the value in a hidden text box (that table field you wanted) change the backgroup color...

some thing like this i think...

if me!bcolor = 1 then
me.BackColor = vbBlack
end if

if me!bcolor = 2 then
me.BackColor = vbwhite
end if

I would accualy suggest a select case, but i don't know how to code them for an example...

--James
junior1544@jmjpc.net
Life is change. To deny change is to deny life.
 
Did you forget that you already created a thread on this topic yesterday Micky ?

thread702-344950 still don't see which bit you are having trouble with.


G LS
 
Hi, I currently do what you are describing for a company that uses two color options depending on if it's the union side or the non-union side. I did this by creating a table with one record. The record contains two company colors.
On the main menu I have a sub-form that prompts for 'Is this a Union Job?' If the user selects the check box then then it changes colors.
In the form's 'current' and 'on load' properties I have a select case statement that checks to see if 'Union' is selected in the single record. If it is, then the following occurs:

Private Sub Form_Current()
Select Case Check30
Case Is = True
Me.Detail.BackColor = 1027580
Me.ImageUnion.Visible = True
Me.ImageNonUnion.Visible = False
Case Is = False
Me.Detail.BackColor = 1107967
Me.ImageUnion.Visible = False
Me.ImageNon.Visible = True

End Select


DoCmd.Maximize
Recalc
End Sub

Since I don't have that many forms, I add these statements to each form. There probably is a way to do it globally - if there is I'd be most interested learning how.

Hope that helps.
 
pdldavis - as you are not going to swap between union and nonunion as you get between records in the table ( are you ? ) then you can put the same code in the OnOpen or OnLoad events. This means that the code will run once when you open the form instead of running every time you change the record that the form is viewing.


As for other ideas - see the earlier responce on the original thread as refered to above.



G LS
 
GLS,
You're right, I'll put the code in the correct place. Thanks.
 
pdldavis - Thinking further, you can also shorten your code more .. ..

Private Sub Form_Current()

If Check30 Then
Me.Detail.BackColor = 1027580
Else
Me.Detail.BackColor = 1107967
EndIf

Me.ImageUnion.Visible = Check30
Me.ImageNonUnion.Visible = Not Check30


DoCmd.Maximize
Recalc
End Sub


'ope-that-'elps.

G LS

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top