473,387 Members | 1,465 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.

Formatting a text box based on the contents of another

I would like to use conditional formatting on a subform and have 2
textbox affected.

ItemID Qty Cost OrderDate
123 1 10.00 3/3/05
345 2 5.00 3/2/05
678 1 7.00 3/3/05

In the above example, if the date in a combo box is 3/3/05, I want the
text in ItemID and OrderDate to be green for just those records with an
OrderDate 3/3/05. I have it so that the OrderDate turns green but not
the Item ID.

With Forms("frmOrders").Controls("OrderDate").FormatCon ditions _
.Add(acFieldValue, acEqual, "=Forms!frmOrders![cboOrderDate]")
.ForeColor = vbBlue
End With

What can I add to make the ItemID font turn color also just for those
records with an OrderDate 3/3/05?

Thank you,
Deborah
Nov 13 '05 #1
3 1884
Deborah V. Gardner wrote:
I would like to use conditional formatting on a subform and have 2
textbox affected.

ItemID Qty Cost OrderDate
123 1 10.00 3/3/05
345 2 5.00 3/2/05
678 1 7.00 3/3/05

In the above example, if the date in a combo box is 3/3/05, I want the
text in ItemID and OrderDate to be green for just those records with an
OrderDate 3/3/05. I have it so that the OrderDate turns green but not
the Item ID.

With Forms("frmOrders").Controls("OrderDate").FormatCon ditions _
.Add(acFieldValue, acEqual, "=Forms!frmOrders![cboOrderDate]")
.ForeColor = vbBlue
End With

What can I add to make the ItemID font turn color also just for those
records with an OrderDate 3/3/05?


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Wouldn't it be the same thing, just change the reference to the control:

With Forms("frmOrders").Controls("ItemID").FormatCondit ions
.Add(acFieldValue, acEqual, "=Forms!frmOrders![cboOrderDate]")
.ForeColor = vbGreen
End With

Of course you know that if the VBA code is in the module of the form you
are referencing you can use the "Me" keyword:

With Me!ItemID.FormatConditions
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQjIEuYechKqOuFEgEQKP8QCgiyrs0e0Sns8MPJG2y9MTAK 8z02wAoOss
5udMSVdrj1THebBkQzgia3eQ
=Hu9A
-----END PGP SIGNATURE-----
Nov 13 '05 #2
I did try your suggestion. I also tried

With Forms("frmOrders").Controls("ItemID").FormatCondit ions
.Add(acFieldValue, acEqual,
"OrderDate=Forms!frmOrders![cboOrderDate]")
.ForeColor = vbGreen
End With

Also, I am aware of the Me clone but thanks for suggesting it. I usually use
it but didn't since I copied this code and just changed it to reflect my
controls.

Deborah

MGFoster wrote:
Deborah V. Gardner wrote:
I would like to use conditional formatting on a subform and have 2
textbox affected.

ItemID Qty Cost OrderDate
123 1 10.00 3/3/05
345 2 5.00 3/2/05
678 1 7.00 3/3/05

In the above example, if the date in a combo box is 3/3/05, I want the
text in ItemID and OrderDate to be green for just those records with an
OrderDate 3/3/05. I have it so that the OrderDate turns green but not
the Item ID.

With Forms("frmOrders").Controls("OrderDate").FormatCon ditions _
.Add(acFieldValue, acEqual, "=Forms!frmOrders![cboOrderDate]")
.ForeColor = vbBlue
End With

What can I add to make the ItemID font turn color also just for those
records with an OrderDate 3/3/05?


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Wouldn't it be the same thing, just change the reference to the control:

With Forms("frmOrders").Controls("ItemID").FormatCondit ions
.Add(acFieldValue, acEqual, "=Forms!frmOrders![cboOrderDate]")
.ForeColor = vbGreen
End With

Of course you know that if the VBA code is in the module of the form you
are referencing you can use the "Me" keyword:

With Me!ItemID.FormatConditions


Nov 13 '05 #3
I figured it out. I changed acFieldValue to acExpression

With Me.Controls("ItemID").FormatConditions
.Add(acExpression, acEqual, "OrderDate=Forms!frmOrders![cboOrderDate]")

.ForeColor = vbGreen
End With

This now works.

Deborah

"Deborah V. Gardner" wrote:
I did try your suggestion. I also tried

With Forms("frmOrders").Controls("ItemID").FormatCondit ions
.Add(acFieldValue, acEqual,
"OrderDate=Forms!frmOrders![cboOrderDate]")
.ForeColor = vbGreen
End With

Also, I am aware of the Me clone but thanks for suggesting it. I usually use
it but didn't since I copied this code and just changed it to reflect my
controls.

Deborah

MGFoster wrote:
Deborah V. Gardner wrote:
I would like to use conditional formatting on a subform and have 2
textbox affected.

ItemID Qty Cost OrderDate
123 1 10.00 3/3/05
345 2 5.00 3/2/05
678 1 7.00 3/3/05

In the above example, if the date in a combo box is 3/3/05, I want the
text in ItemID and OrderDate to be green for just those records with an
OrderDate 3/3/05. I have it so that the OrderDate turns green but not
the Item ID.

With Forms("frmOrders").Controls("OrderDate").FormatCon ditions _
.Add(acFieldValue, acEqual, "=Forms!frmOrders![cboOrderDate]")
.ForeColor = vbBlue
End With

What can I add to make the ItemID font turn color also just for those
records with an OrderDate 3/3/05?


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Wouldn't it be the same thing, just change the reference to the control:

With Forms("frmOrders").Controls("ItemID").FormatCondit ions
.Add(acFieldValue, acEqual, "=Forms!frmOrders![cboOrderDate]")
.ForeColor = vbGreen
End With

Of course you know that if the VBA code is in the module of the form you
are referencing you can use the "Me" keyword:

With Me!ItemID.FormatConditions


Nov 13 '05 #4

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

Similar topics

3
by: Jouke Langhout | last post by:
Hello all! For quite some time now, I've got the following problem: Access won't close properly when a user closes the application. An ACCESS process stays active and that process can only be...
2
by: Colleyville Alan | last post by:
I am using Access and have embedded the ActiveX control Formula One that came with Office 2000. (ver 3.04). I have created and formatted a spreadsheet and now I want to copy the info with...
4
by: Bradley | last post by:
I have an A2000 database in which I have a continuous form with a tick box. There is also a text box with a conditional format that is based on the expression , if it's true then change the...
5
by: Andrew Chanter | last post by:
Does anyone know a way you can use conditional formatting to create a banded style view as is commonly seen on the internet. (In othe words the first record appears on a gray background, the 2nd...
7
by: BBFrost | last post by:
I'm receiving decimal values from database queries and placing them on a report page. The users want to see the following .... Db Value Display Value 123.3400 123.34...
6
by: Glen | last post by:
Hello again, I don't blame anyone for not answering my last post, since I obviously hadn't spent much time researching, but I've come a little ways and have another question. How can I better...
4
by: lupo666 | last post by:
Hi everybody, this time I have three problems driving me nuts :-((( (1) I have a report with 20 or so Yes/No "squares". Is there a way to either hide/show the "square" or change the yes/no...
2
by: robertng90025 | last post by:
I'm having a problem with MS Access 2003 and its conditional formatting. I have textboxes on a continuous form whose left and right margins are set to 0.03 inches. Based on each textbox's...
6
by: =?Utf-8?B?UVNJRGV2ZWxvcGVy?= | last post by:
I am using a RichTextControl (C# VS2005 .NET 2.0) and allowing users to change the font and color of what ever they select. The problem I am having is that when I select a second set of character...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: 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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.