Control property .visible and .enabled

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

Guest

I have the following code as an event tied to a combo box that brings up a
record on the main form.


If Me![DateAndTimeVL] = "" Then
Me![DateAndTimeVL].Enabled = True
Me![DateAndTimeVL].Locked = False
Else
Me![DateAndTimeVL].Enabled = False
Me![DateAndTimeVL].Locked = True
End If

If the field dateandtimevl is empty the control is still locked.
 
Which event? There may be a timing issue depending on which event you've
placed this in. Also, Empty is usually Null, not a zero length string.
 
I have the following code as an event tied to a combo box that brings up a
record on the main form.

If Me![DateAndTimeVL] = "" Then
Me![DateAndTimeVL].Enabled = True
Me![DateAndTimeVL].Locked = False
Else
Me![DateAndTimeVL].Enabled = False
Me![DateAndTimeVL].Locked = True
End If

If the field dateandtimevl is empty the control is still locked.

Try:
If IsNull(Me![DateAndTimeVL]) Then
etc....
 
This code was placed in the after update event of the combo box. What would
be proper syntax to check for null

Thanks,
Bob

--
BT


Wayne Morgan said:
Which event? There may be a timing issue depending on which event you've
placed this in. Also, Empty is usually Null, not a zero length string.

--
Wayne Morgan
MS Access MVP


BobT said:
I have the following code as an event tied to a combo box that brings up a
record on the main form.


If Me![DateAndTimeVL] = "" Then
Me![DateAndTimeVL].Enabled = True
Me![DateAndTimeVL].Locked = False
Else
Me![DateAndTimeVL].Enabled = False
Me![DateAndTimeVL].Locked = True
End If

If the field dateandtimevl is empty the control is still locked.
 
fredg said:
I have the following code as an event tied to a combo box that brings up
a
record on the main form.

If Me![DateAndTimeVL] = "" Then
Me![DateAndTimeVL].Enabled = True
Me![DateAndTimeVL].Locked = False
Else
Me![DateAndTimeVL].Enabled = False
Me![DateAndTimeVL].Locked = True
End If

If the field dateandtimevl is empty the control is still locked.

Try:
If IsNull(Me![DateAndTimeVL]) Then
etc....

Or, if you're a belt-and-suspenders type,

If Len(Trim(Me![DateAndTimeVL] & "")) = 0 Then
...etc.
 
The IsNull function worked!!!!! Sheesh, spent 2 hours this afternoon on this
one! :)

Interesting syntax check will allow If [string] is null then


Thanks all.
Bob

--
BT


fredg said:
I have the following code as an event tied to a combo box that brings up a
record on the main form.

If Me![DateAndTimeVL] = "" Then
Me![DateAndTimeVL].Enabled = True
Me![DateAndTimeVL].Locked = False
Else
Me![DateAndTimeVL].Enabled = False
Me![DateAndTimeVL].Locked = True
End If

If the field dateandtimevl is empty the control is still locked.

Try:
If IsNull(Me![DateAndTimeVL]) Then
etc....
 
Back
Top