Re: Change Button caption when text field "changes"

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Ruskin (ruhardie_at_nospam.xtra.com)
Date: 04/05/04


Date: Tue, 6 Apr 2004 10:20:13 +1200

Try something like the following (where dteField is the name of the date
field, so you will need to replace this with txtDisabled)....

Private Sub cmdEnableDisable_Click()
    If IsNull(dteField) Then
        dteField = Now
        cmdEnableDisable.Caption = "Disable"
    Else
        dteField = Null
        cmdEnableDisable.Caption = "Enable"
    End If
End Sub

Private Sub Form_Current()
    If IsNull(dteField) Then
        cmdEnableDisable.Caption = "Enable"
    Else
        cmdEnableDisable.Caption = "Disable"
    End If
End Sub

"AnExpertNovice" <j@The~N_o~S_p_a_m~PostOffice.com> wrote in message
news:eLPONc1GEHA.3188@TK2MSFTNGP10.phx.gbl...
> There is probably an easy solution. I have just not found it yet!
>
> txtDisabled contains the date the record was disbled. It is Enabled but
> Locked. (allows copy)
>
> cmdEnableDisable is a button used to set or clear txtDisabled. It would
be
> nice if it read "Disable" then txtDisabled was empty and "Enable" when
> txtDisable contains a date.
>
> Is there a easy way to detect when txtDisabled has changed or may have
> changed. By "may have changed" even changing to a different record means
the
> buttons caption can be set after a query. I have found no text field or
> form event that allows this to be done.
>
> Thanks.
>
>


Quantcast