473,804 Members | 3,705 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1528

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*****@netspa ce.net.au> schreef in bericht
news:42******** **@news.melbour ne.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******@examp le.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*****@netspa ce.net.au> wrote in message
news:42******** @news.melbourne .pipenetworks.c om...
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
14697
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 anyone help me to get started on how i would accomplish this?
2
1848
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 sheet or something else to change the links in just a part of a table?
4
1972
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 to 4 by using the rnd() function and then dividing by modulus 4. The result was then used to select a cell in a 4 cell array which was holding a different colour in each cell of the array. I would like to have this code but lack the knowledge to...
6
56646
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" cols="240,*"> <frame name="links" scrolling="no" noresize target="contents" src=""> <frameset bgcolor="#000000" frameborder="0" border="0" rows="135,*"> <frame name="topbanner" scrolling="no" src="">
8
2261
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 GIF and I have forgotten what the main page was. Apart from lining up the parts of the image, there was no discrepancy in colours between the two formats. Is that what "Web-safe" means? I thought that it just meant that the colours would be the...
11
2496
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", Console.ForeColor.ToArgb.ToString) Srx.SetValue("BackColour", Console.BackColor.ToArgb.ToString) Then, I try to read the colours back in at runtime and change the
6
1267
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: Class A, Red, Maroon, Cerise Class B, Violet, Mauve, Purple Class C, Emerald, Forest, Lime My 'Rooms' table:
3
1196
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 vb.net which makes it a bit harder to find anything Open to any ideas but searching google. ty Mague ps. Im a kid (13) Not to technicle thanks
7
7422
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 can automate the colour of the label, so that the colours for the label can keep on changing nicely and smoothly from one end to the other. Such as the colours moves per letter or per word from left to right towards the end of the sentence, or from a...
0
9576
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10568
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10311
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7613
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6847
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5516
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5647
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4292
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2988
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.