disable command button after click (1 Viewer)

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 05:12
Joined
Feb 28, 2001
Messages
27,308
Is it possible to allow the command button to be clicked once and anytime the form is reopened and the user click the button again it prompts the user that the button has been clicked already. example, this record have been submitted already.

MarkK has part of this thread. I'll answer differently. All sorts of things are possible but in the scenario you just named, they might be unlikely. If a form is actually closed and then re-opened, the odds of it stepping to the last record you saved are low unless you modify the Form_Load routine to somehow navigate to that record. Given your previous disclaimer of VBA comfort, odds are that the record in question will be one you saved earlier but NOT the last one. It is possible with VBA to test for whether the current record has been saved by testing the form's Dirty property.

If there is some field on the form that would be unique, then placing a unique index on that field would prevent the form from storing a duplicate of it. That would, of course, force you to trap the error that would occur during the update attempt. It might be easier to design this to never incur that error in the first place, based on an offhand comparison of relative difficulty in doing either - for a novice VBA programmer.
 

Users who are viewing this thread

Top Bottom