473,387 Members | 1,925 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

changing fields colours

I need to create a button which changes the back colour and the font colour
and type of several fiels in a form, This is the way I would normally do it:
[Date].Backcolor = 11112121
[Date].tabstop = True
[Customer No].Backcolor =
etc

is there a way I can do it for all of them grouped together, given that the
whole group needs to change to the same colours?

Thanks
Paolo
Nov 13 '05 #1
5 1502

Paolo wrote:
I need to create a button which changes the back colour and the font colour and type of several fiels in a form, This is the way I would normally do it: [Date].Backcolor = 11112121
[Date].tabstop = True
[Customer No].Backcolor =
etc

is there a way I can do it for all of them grouped together, given that the whole group needs to change to the same colours?

Thanks
Paolo


Hi Paulo,
You can set the tag property of the control to a value to check
for and then use a for each statement like below:

'************************************************* ***
Dim x As Control

For Each x In Controls
If x.Tag = "True" then
x.Backcolor = 11112121
x.tabstop = True
End if
Next x
'************************************************* ***

In the example above, it is assumed that the Tag value has True typed
into it. Hope this helps.

David Hodgkins
JSTAR Software Solutions - Home of AutoCompact
www.jstarsoftware.com

Nov 13 '05 #2

"Paolo" <pr*****@netspace.net.au> schreef in bericht
news:42**********@news.melbourne.pipenetworks.com. ..
I need to create a button which changes the back colour and the font colour and type of
several fiels in a form, This is the way I would normally do it:
[Date].Backcolor = 11112121
[Date].tabstop = True
[Customer No].Backcolor =
etc

is there a way I can do it for all of them grouped together, given that the whole group
needs to change to the same colours?


You could use something like

Dim ctrl As Control
For Each ctrl In Me.Controls
Select Case ctrl.Name
Case "Date", "Customer No"
ctrl.Backcolor = 11112121
ctrl.tabstop = True
End Select
Next

--
Hope this helps
Arno R

Nov 13 '05 #3
On Sat, 19 Mar 2005 19:06:46 +1100, Paolo wrote:
I need to create a button which changes the back colour and the font colour
and type of several fiels in a form, This is the way I would normally do it:
[Date].Backcolor = 11112121
[Date].tabstop = True
[Customer No].Backcolor =
etc

is there a way I can do it for all of them grouped together, given that the
whole group needs to change to the same colours?

Thanks
Paolo


You've received several replies by now, telling you how to change
control properties, so I'll call your attention to another aspect of
database design you may not be aware of... your use of the word "Date"
as a field name.

Date is a reserved Access/VBA/Jet word and should not be used as a
field name.
See the Microsoft KnowledgeBase article for your version of Access:

109312 'Reserved Words in Microsoft Access' for Access 97
209187 'ACC2000: Reserved Words in Microsoft Access'
286335 'ACC2002: Reserved Words in Microsoft Access'
321266 'ACC2002: Microsoft Jet 4.0 Reserved Words'

--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
Nov 13 '05 #4
Thanks for the replies guys..

Fred: the control I typed was just an example the controls I have to change
in the form are different ones. But thank you anyway I didn't know about the
date word, good thing for me to know.

Arno I can't really use the function as I have to change different groups
of control inside of the same form.

David yours seems to be what I need but I don't know what the Tag is...
sorry I am very green with VBA and it's hard for me to grasp some concepts..
Again thanks guys

"fredg" <fg******@example.invalid> wrote in message
news:o2******************************@40tude.net.. .
On Sat, 19 Mar 2005 19:06:46 +1100, Paolo wrote:
I need to create a button which changes the back colour and the font
colour
and type of several fiels in a form, This is the way I would normally do
it:
[Date].Backcolor = 11112121
[Date].tabstop = True
[Customer No].Backcolor =
etc

is there a way I can do it for all of them grouped together, given that
the
whole group needs to change to the same colours?

Thanks
Paolo


You've received several replies by now, telling you how to change
control properties, so I'll call your attention to another aspect of
database design you may not be aware of... your use of the word "Date"
as a field name.

Date is a reserved Access/VBA/Jet word and should not be used as a
field name.
See the Microsoft KnowledgeBase article for your version of Access:

109312 'Reserved Words in Microsoft Access' for Access 97
209187 'ACC2000: Reserved Words in Microsoft Access'
286335 'ACC2002: Reserved Words in Microsoft Access'
321266 'ACC2002: Microsoft Jet 4.0 Reserved Words'

--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.


Nov 13 '05 #5
Tag is a property of a control {button, text box etc.}. It shows on the
'Options' tab of the properties window when a control is selected.
Pete.

"Paolo" <pr*****@netspace.net.au> wrote in message
news:42********@news.melbourne.pipenetworks.com...
Thanks for the replies guys..

Fred: the control I typed was just an example the controls I have to
change
in the form are different ones. But thank you anyway I didn't know about
the
date word, good thing for me to know.

Arno I can't really use the function as I have to change different groups
of control inside of the same form.

David yours seems to be what I need but I don't know what the Tag is...
sorry I am very green with VBA and it's hard for me to grasp some
concepts..
Again thanks guys

Nov 13 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: NeoPhreak | last post by:
I am creating a menu for my site and I would like it so that when the onMouseOut even is triggered it will cause the cell of the table to fade out back to the normal color with a delay. Can...
2
by: Derek Fountain | last post by:
Is it possible to change the colours of links in part of a document? i.e. where I could set link, alink and vlink in the body tag, it would change the links in the whole document. Can I use a style...
4
by: david.graham18 | last post by:
Hi I spotted some nice code to change the background colour of a web page to one of four different colours at random but I can't find it now! The method was to select a number at random from 1...
6
by: Nancy Carter | last post by:
I'm trying to set the background color of a frameset to black. The following code doesn't work in either IE 6.0 or Firefox. Any ideas why? <frameset bgcolor="#000000" frameborder="0" border="0"...
8
by: Doug Laidlaw | last post by:
I tried to grab an image from a Web page the other day. It turned out that the page was made up of three horizontal bands, and part of the image was in each. One band was a JPEG, another was a...
11
by: Hugh Janus | last post by:
OK, this is driving me crazy! As far as I can tell it should work. It compiles fine. I am saving the fore and back colour of a RTB to the registry like this: Srx.SetValue("ForeColour",...
6
by: danseuse | last post by:
It's been a loooong time since I've worked with Access. I want to be able to do queries on 'Class'. My 'Class' table: Fields: Class, Element 1, Element 2, Element 3 Data: ...
3
Mague
by: Mague | last post by:
Hey, I need to change colours in a richtextbox. I am making a simple html editor. i want to make the tags different colours. I have searched google so please dont say search google. I also use...
7
by: emlimeng | last post by:
Hello, I have a label on the form to draw people's attention so they do not forget to input the data in a particular section. e.g. "Please carefully check all the options on the form". I hope I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.