Disabling Delete Button

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form where user can only add and delete records (no edits are allowed), all work well
It is just that one thing that don't really satisfy me ,which is to disable the delete button when user is adding new record that has not yet comitted or where there is no record at all. and to enable it when it is pointing to a record

Many thanks in advance
Djoezz
 
Hi,

There is a Form property called NewRecord that returns true when adding a
new record.

So if you put code like the following in the form's current event then the
delete button would be disabled and enabled:

If Me.NewRecord Then
Me.cmdDelete.Enabled = False
Else
Me.cmdDelete.Enabled = True
End If

Note. change the cmdDelete to the name of the delete button.

HTH

--

Cheers
Mark

Free Access/Office Add-Ins at:
http://mphillipson.users.btopenworld.com/


djoezz said:
I have a form where user can only add and delete records (no edits are allowed), all work well.
It is just that one thing that don't really satisfy me ,which is to
disable the delete button when user is adding new record that has not yet
comitted or where there is no record at all. and to enable it when it is
pointing to a record.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top