Enable cmdButton based on existance of value in text box

  • Thread starter Thread starter MSD
  • Start date Start date
M

MSD

Hi,
I have text box (DateDisplay) that gets value through DLookup function.
I would like to enable command (InsertCmd) button if there is no value in
the text box (DateDisplay) or enable command button (UpdateCmd) if there
exists value in the text box (DateDisplay)

How do I accomplish this?

Thanks in advance
 
MSD

You can use code similar to the following...
Me.InsertCmd.Enabled = IsNull(Me.DateDisplay)
Me.UpdateCmd.Enabled = Not IsNull(Me.DateDisplay)

The trickier question is where this code should run. Maybe the On
Current event of the form would be applicable?
 
MSD

You can use code similar to the following...
Me.InsertCmd.Enabled = IsNull(Me.DateDisplay)
Me.UpdateCmd.Enabled = Not IsNull(Me.DateDisplay)

The trickier question is where this code should run. Maybe the On
Current event of the form would be applicable?

Steve,
Thanks for the response, I used following based on your suggestion:
InsertCmd.Enabled = (IsNull(Me!DateDisplay.Value))
UpdateCmd.Enabled = Not (IsNull(Me!DateDisplay.Value))

Thanks,
-MSD
"I wish people would love everybody else the way they love me. It would
be a better world."
Muhammad Ali
 
Back
Top