IF Statements - multiple "do this" criteria

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi Guys,

When using an IF statement can I do something like this?

If Me.Confirmed = -1 Then
Me.txtDate.Locked = True And Me.txtDate.ForeColor = vbRed
Else...

EndIf etc

Basically I can't use conditional formatting because the criteria is
checking whether a checkbox is ticked. If the box is ticked I basically want
to lock the control and change the forecolour to Red. Currently the lock
works but not the ForeColor property.

Cheers for any helpful hints & tips


Wendy
 
That would be ...

If Me.Confirmed = -1 Then
Me.txtDate.Locked = True
Me.txtDate.ForeColor = vbRed
Else...

EndIf etc

In other words, you can insert multiple statements between the If and the
Else (or between the Else and the EndIf).
 
Hi Guys,

When using an IF statement can I do something like this?

If Me.Confirmed = -1 Then
Me.txtDate.Locked = True And Me.txtDate.ForeColor = vbRed
Else...

EndIf etc

Basically I can't use conditional formatting because the criteria is
checking whether a checkbox is ticked. If the box is ticked I basically want
to lock the control and change the forecolour to Red. Currently the lock
works but not the ForeColor property.

Cheers for any helpful hints & tips

Wendy

Place this code in the Form's Current event as well as the [Confirmed]
AfterUpdate event:

If Me!Confirmed = -1 Then
Me!txtDate.ForeColor = vbRed
Me!txtDate.Locked = True
Else
Me!txtDate.ForeColor = vbBlack
Me!txtDate.Locked = False
End If
 
I basically want
to lock the control and change the forecolour to Red. Currently the lock
works but not the ForeColor property.

Odd things happen to colours when you set the Enabled and Locked
properties. Are you sure that Access will honour your ForeColor setting on
a locked control?

HTH


Tim F
 
Back
Top