Inactive Cmd Button

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

Guest

I have a .db that tracks computer equipment. On one of my forms I currently
have a command button that is setup to delete records. I no longer want to
delete them but instead make them inactive so I created another cmd button
that when depressed will inactivate them rather than delete. I created an
inactive checkbox and two other fields that when the checkbox is checked it
automatically populates the fields with the date and current user. What I
would like to do if possible is have the delete cmd button disabled after it
is pressed once that way it can't be accidently undeleted by mistake. Or
even make the whole record locked. What would be the code that I can put
behind the button in order to do this or can this even be done?

I also have added a toggle button to the form that I would like to apply a
filter so that I can see active or inactive by toggling the button but I'm
not sure how to do this. Would I need to add code on click on the button.

Any help would be appreciated.
 
If you want to prevent deletions why not just remove the delete button and
set the form Property Allow Deletions = No?

I don't think there is a way to prevent undeletes. It has nothing to do with
the delete button anyway, it is most commonly done by pressing Ctl+Z which
can happen with or without a delete button.

Addinga toggle button without code or macro just puts a pretty button on
the screen. You difinately need to add code to make it do anything. It
sounds like you a a bit new. Are you comfortable adding code?

How about customizing the toolbar or create your own cusom one from scratch?
Right click the toolbars and click Customize. From here you can either
customize the regular tool bar or create your own. There are options under
the Records menu for filtering and sorting that may meet your needs.

Otherwise you need to add code that checks the value of the toggle button
(0=up, -1=down) and either changes the form's record source or applies a
filter accordingly.

More info would be helpful
Tony Vrolyk
 
Thanks for your reply.

I didn't know that you could set the form property to not allow deletions,
that'll work great.

As for the button, I don't necessarily need a toggle btn but what I would
like to ultimately do is have some way the users can sort through the active
and inactive records. I have already added the yes/no field (inactive),
where the user can check off if the record is no longer existing.

I know that if you add a btn you can add code to btn when it is clicked. I
have done a small amount of coding in the past so I am pretty comforatable
with it, I'm just not familiar with the syntax. I have tried adding a filter
by form and then adding that to a cmd btn. That works and shows the inactive
records but I need a way to go back to seeing all records or just the active
ones.

Thanks.
 
Back
Top