Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to disable and enable the button when text value changed

Status
Not open for further replies.

tekaccess

Programmer
Oct 24, 2006
31
CA
Hi to all
I want to make a some button disable on openform event and when during the entry process a user enter a date in date field after checking with the current date(less tahn current date) the disabled button suould be enabled.
Any suggestion.
I am trying onchage event:

Private Sub Form_Open(Cancel As Integer)
cmddone.Enabled = False

End Sub

Private Sub RMAReceive_Change()
If Len(RMAReceive) = 10 Then
cmddone.Enabled = True
End If

End Sub

rma receive is date type text box.
 
Howdy tekaccess . . .

Try the following in the [blue]BeforeUpdate[/blue] event of your date field:
Code:
[blue]   If IsDate(Me!Date) Then
      Me![purple][b][i]ButtonName[/i][/b][/purple].Enabled = (Me!Date < Date)
   Else
      MsgBox "Wrong date format!"
      Me![purple][b][i]ButtonName[/i][/b][/purple].Enabled = False
      Cancel = True
   End If[/blue]

Calvin.gif
See Ya! . . . . . .
 
Hi TheAceMan1
You are the man, thanks its worked
Can i use if or case stement formultiple check on date and other fields.
such as compare date, checkbox and some other field.
-------------------
Private Sub RMAReceive_BeforeUpdate(Cancel As Integer)
If IsDate(Me!RMAReceive) Then
Me!cmddone.Enabled = (Me!RMADate < RMAReceive) and rmasent=true and damge=true
Else
MsgBox "Wrong date format!"
Me!cmddone.Enabled = False
Cancel = True
End If

End Sub
------------------
User have to select the rmasent and damge check box.

Thanks
 
tekaccess said:
[blue]Can i use if or case stement formultiple check on date and other fields.
[purple]such as compare date, checkbox and some other field[/purple].[/blue]
Sure! . . . How you mix it up is your choice! [thumbsup2]

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top