Conditional Formatting on Subform

G

Gitche Gumee

Here's my setup:

Main form with tab control

Tab1 has a subform (Subform1). That subform has a subform (Subform1A).

Tab2 has a subform (Subform2).

I have conditional formatting on a field (Field1A) in Subform1A that depends
on the value of a field in Subform1 (Field1). In the AfterUpdate Event of
Field1, I requery Subform1A. The conditional formatting doesn't happen
without requerying the subform.

All works fine as long as I stay on Tab1. When I click Tab2 and then click
back to Tab1, the conditional formatting in Subform1A is hosed. Subform1A
does not seem to know the value of Field1 anymore to set the conditional
formatting. I can get Subform1A to display properly again by selecting
Records | Refresh. But I can't seem to make this work programmatically.

I have tried requerying the Main Form, Subform1 and Subform2 in the GotFocus
event of Subform1, and other things I'm sorry I don't remember right now. Can
anyone give me any insight?
 
W

Wayne-I-M

Are you using vba (on the main form) to set the formating on IA or have you
used the condtional formating wizard (can you post the formula)

If you are using vba on the main form - can you post it so we can see it.

Have you tried open the sub form (on it's own) in design view to see if this
ake a difference

Either way, if you post the code or formula then we can (maybe) see where
the problem is
 
G

Gitche Gumee

I'm using conditional formatting. I have discovered that I had a typo in my
reference to Field1 in the conditional formatting. Grr. That's why nothing I
tried worked.

For posterity, my conditional formatting (correct version) looks like this:

Expression Is: [ITResources]=-1 And IsNull([ItAppDev]) And
Forms![frmMain].[frm Project Information].Form.[cboDisposition]="Active"

I had to add a Save Record command in the AfterUpdate event of Field1 along
with requerying Subform1A.

Code:
DoCmd.RunCommand acCmdSaveRecord
Me.[tblProjectResourceFocus subform1].Form.Requery

It works now.
 
C

Cal Mc

Try creating a macro with the command 'Repaint', and put it in the
onGotFocus event in the tab properties.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top