Question : MS Access 2003 ADP using 2 dependant combo boxes but getting error

Hi,

I have tried the standard access code for using a dependant combo box. but not getting any joy with the adp to a ms sql db. The adp project reports an error with using [forms]![formexample]![combo2]

Please help?

Answer : MS Access 2003 ADP using 2 dependant combo boxes but getting error

Hi Bruj,

I studied the problem and discovered new and amazing thing for me. Never before I've met a task where there was necessary to use Activecell.
I found that when we assign Formula to the Format Condition, it is translated as if being applied to the Activecell. So if we've composed a formula for the top left cell of CF range (assuming that it has proper relative/absolute references to be expanded over the range) we must set Activecell to the top left cell of CF range. The easiest way to do this is to select the CF range. So you were right in general about selection.

I hope that this macro is suitable for you.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
Private Sub Workbook_Open()
Dim lastRow As Long
With Worksheets("Sheet1")
    .Cells.FormatConditions.Delete  'DELETE ALL COND FORMATTING
    lastRow = .Rows.Count
    With .Range("A3:O" & lastRow)   'SET default object, all expressions starting with
                                    '"." will refer to it. Note nested "With"
        .Select                     'to set ActiveCell to top left corner of the range
        .FormatConditions.Add Type:=xlExpression, Formula1:="=COUNTIF($E$3:$E3,$E3)>1"
        .FormatConditions(1).Interior.ColorIndex = 44
        .FormatConditions(1).StopIfTrue = True
        .FormatConditions.Add Type:=xlExpression, Formula1:="=COUNTIF($E$3:$E$" & lastRow & ",$E3)>1"
        .FormatConditions(2).Interior.ColorIndex = 37
        .FormatConditions.Add Type:=xlExpression, Formula1:="=UPPER($K2) = ""YES"""
        .FormatConditions(3).Interior.Color = vbRed    'Red
    End With
End With
End Sub
Random Solutions  
 
programming4us programming4us