Trouble with conditional formatting

jjake

Registered User.
Local time
Yesterday, 23:35
Joined
Oct 8, 2015
Messages
291
Hello,

I am currently using the following code in VBA to disable/enable a text box.

Code:
DLookUp("[Department]","[tblUsers]","[UserTag]='" & [Me].[txtUser] & "'")=2

I have tried using this same expression in conditional formatting to enable a different box but it isn't working. Any idea why?
 
Conditional formatting cannot disable a box, it simply changes the formatting. Try it without Me like:
DLookUp("[Department]","[tblUsers]","[UserTag]='" & [txtUser] & "'")=2

Cheers,
Vlad
 
You can easily do this in code

Code:
if DLookUp("[Department]","[tblUsers]","[UserTag]='" & [txtUser] & "'")=2 Then
Me.othertextboxname.Enabled=True
End If

Use this code in a suitable procedure e.g. The after update event of txtUser control
 
Ridders, i currently have this textbox using conditional formatting to enable/disable using the following expression

Code:
[RDReview]=1 And [ProductionReview]=1 And [MaintenanceReview]=1 And [SafetyReview]=1 And [SiteManagerReview]=1

How would i combine this with the code you provided?
 
Just combine them like this

Code:
if DLookUp("[Department]","[tblUsers]","[UserTag]='" & [txtUser] & "'")=2 And [RDReview]=1 And [ProductionReview]=1 And [MaintenanceReview]=1 And [SafetyReview]=1 And [SiteManagerReview]=1 Then
     Me.othertextboxname.Enabled=True
End If
 
Last edited:
@bastanu, yes ConditionalFormatting can enable/disable.

I agree that Me. must be removed from the ConditionalFormatting expression.

Me. and Me! only work in VBA.
 

Users who are viewing this thread

Back
Top Bottom