nathan2314
01-14-2009, 10:05 AM
Hello all:hi:
I think this should be relatively easy but I cant get it to work. I'm trying to set a check box to false if another text box on my form is blank or has a default text in it. I get it to work fine with the default text but for some reason if I clear the text box the check box does not uncheck.
Here is my VBA code so far:
Private Sub Donation1_AfterUpdate()
If Me.Donation1 Is Null Or Me.Donation1 = "Enter Name of Person or Charity" Then
Me.Donations = False
Else
Me.Donations = True
End If
End Sub
Do in the code, Me.Donation1 is the text box and Me.Donations is the check box. So I want Me.Donations to unchick (false) if the text box, Me.Donations1, is either an empty string (blank) or has the default value of "Enter Name of Person or Charity" in it. The code works for the default value but does not work for the empty string. Ive tried substituting 'Empty', "" and '= Null' for the "Is Null" part of the above code. But that doesnt work either.
Appreciate any help!
:yes
I think this should be relatively easy but I cant get it to work. I'm trying to set a check box to false if another text box on my form is blank or has a default text in it. I get it to work fine with the default text but for some reason if I clear the text box the check box does not uncheck.
Here is my VBA code so far:
Private Sub Donation1_AfterUpdate()
If Me.Donation1 Is Null Or Me.Donation1 = "Enter Name of Person or Charity" Then
Me.Donations = False
Else
Me.Donations = True
End If
End Sub
Do in the code, Me.Donation1 is the text box and Me.Donations is the check box. So I want Me.Donations to unchick (false) if the text box, Me.Donations1, is either an empty string (blank) or has the default value of "Enter Name of Person or Charity" in it. The code works for the default value but does not work for the empty string. Ive tried substituting 'Empty', "" and '= Null' for the "Is Null" part of the above code. But that doesnt work either.
Appreciate any help!
:yes