Re: enable/disable button based on textbox
Originally Posted by Jere
...Now is there a way to have the button disabled right after clicking on it...
Bob gave you that:
Originally Posted by bob fitz
...Use code in the button's On Click event to enter a value in the text box. Then set the focus to another control (perhaps the text box) and then set the Enabled property of the button to false....
Personally, I would only use the code in the OnCurrent
event, so that the Command Button
would only be Disabled after the Record is saved
. I would also make the button
essentially a 'toggle
' button, in effect, so that if the users click on it, and realize that they've made a mistake, before leaving the Record
, they can click the button again and reset the Textbox
. Something like
Private Sub btnTimeStamp_Click()
If IsNull(Me.txtTimeStamp) Then
Me.txtTimeStamp = Now()
Me.txtTimeStamp = Null
if you only need the date portion
, rather than the date and time
The Devil's in the Details!
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
(All code solutions tested in Access 2003/2007, before posting, unless otherwise noted.)
Last edited by missinglinq; 08-12-2013 at 03:01 PM.