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

Using Conditional formatting with queries on continuous forms

Hello all,

I've seen many discussions regarding continuous forms in Access and how to highlight individual rows and they all seem to suggest conditional formatting as the only way.

This is fine, but I am struggling to understand if it will solve my problem.

I have two subforms on a main form that contain many rows of data. What I want to do is highlight in subform 2 those rows that are not present in subform 1.

I am using a query from within VB to determine this and it appears to be working. Once the result is determined any new rows should be highlighted red. Currently all are highlighted red.

Is there a way I can get this to work either using conditional formatting or via some other method?

And also will invoking my code work with on_load function or will this only evaluate the first entry in the subform?

Any help would be greatly appreciated - I've been searching for ages on this!

Thanks,

Steve.
Jul 5 '07 #1
3 7442
puppydogbuddy
1,923 Expert 1GB
Hello all,

I've seen many discussions regarding continuous forms in Access and how to highlight individual rows and they all seem to suggest conditional formatting as the only way.

This is fine, but I am struggling to understand if it will solve my problem.

I have two subforms on a main form that contain many rows of data. What I want to do is highlight in subform 2 those rows that are not present in subform 1.

I am using a query from within VB to determine this and it appears to be working. Once the result is determined any new rows should be highlighted red. Currently all are highlighted red.

Is there a way I can get this to work either using conditional formatting or via some other method?

And also will invoking my code work with on_load function or will this only evaluate the first entry in the subform?

Any help would be greatly appreciated - I've been searching for ages on this!

Thanks,

Steve.
You should be able to do what you want using conditional formatting if you complete the following steps. You did not post your conditional expression. Keep in mind that if this expression is not correctly syntaxed, the conditional formatting won't work.:

1. The control to be conditionally formatted on the continuous form must be bound to a field in the table. If it is unbound, bind it by adding a field to your table for this purpose, or you will continue to show red for all records like you do now..
2. Place the subform in design view
3. Highlight the control that will be conditionally formatted.
4. Go to command menu and select Format>Conditiional Formatting
5. for condition1 first textbox select: Expression is
6 Second texbox enter" Your Conditional expression
7. preview of format textbox: select the red background color that you want formatted control to be when condition is met
8. Click ok button and test.
Jul 5 '07 #2
You should be able to do what you want using conditional formatting if you complete the following steps. You did not post your conditional expression. Keep in mind that if this expression is not correctly syntaxed, the conditional formatting won't work.:

1. The control to be conditionally formatted on the continuous form must be bound to a field in the table. If it is unbound, bind it by adding a field to your table for this purpose, or you will continue to show red for all records like you do now..
2. Place the subform in design view
3. Highlight the control that will be conditionally formatted.
4. Go to command menu and select Format>Conditiional Formatting
5. for condition1 first textbox select: Expression is
6 Second texbox enter" Your Conditional expression
7. preview of format textbox: select the red background color that you want formatted control to be when condition is met
8. Click ok button and test.
Thanks for reply!

The above all makes sense to me, but the problem that I am having is that the expression is a query result in VB - can I pull this into the conditional formatting?

I am running the following query:
X = DLookup("[ParentStoreID]", "tblParentStoreAssociation", "[ParentID]= " _
& newParentID & "AND [ParentVersionID]= " _
& newParentVersionID & "AND [StoreID]= " _
& newStoreID)

Which is basically determining if the value in the current subform already exists in the table.

Then I use the following IF

If Not IsNull(X) Then

and based on the outcome of this I was trying to colour the cells. Can I somehow get this into conditional formatting?
Jul 6 '07 #3
puppydogbuddy
1,923 Expert 1GB
Thanks for reply!

The above all makes sense to me, but the problem that I am having is that the expression is a query result in VB - can I pull this into the conditional formatting?

I am running the following query:
X = DLookup("[ParentStoreID]", "tblParentStoreAssociation", "[ParentID]= " _
& newParentID & "AND [ParentVersionID]= " _
& newParentVersionID & "AND [StoreID]= " _
& newStoreID)

Which is basically determining if the value in the current subform already exists in the table.

Then I use the following IF

If Not IsNull(X) Then

and based on the outcome of this I was trying to colour the cells. Can I somehow get this into conditional formatting?
Steve,
In your case you would do your conditional formatting using vba as shown. Assuming StoreID is bound, you would just put the following expression in the current event of your subform, but you must go back and Dim X as a global variable, leaving your prior code where it is. With global X, the following expression should work nicely in the subform's current event.

Private Sub YourSubform_Current()
If Not IsNull(X) Then
Me.StoreID.BackColor = RGB(200, 0, 0)
End IF
End Sub
Jul 6 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Prakash Wadhwani | last post by:
I have 3 fields : First_Name, Last_Name & Policy_Number I'm using a continuous form. If I invoke conditional formatting on First_Name & set a condition of "Prakash" (change the foreground to...
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...
2
by: Megan | last post by:
Can you write conditional VBA code that affects only one or two records on a continuous subform? I have a form with a subform on it. The parent/ child field that links the forms is CaseID. The...
8
by: Dimitri Furman | last post by:
Given: Access 2002/2003 A subform in datasheet or continuous view, placed on a tab page (this last may or may not matter) Conditional formatting applied to some controls on the subform - format...
2
by: Sara | last post by:
The problem: Conditional formatting bold, red when field Value < date() sets the field background to white - always - whether condition is met or not. I want the field unfilled and just red/bold...
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...
0
by: GGerard | last post by:
Hello With MSAccess 2000, I have created a program with forms and applied some Conditional Formatting on some of the text box.
11
by: tg989 | last post by:
Okay, here goes. Continuous forms... possibly the best feature of access. The only downside is this: the only way to have a conditional evaluation run on each record invididually is by...
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...
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
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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.