Creating a command button that can only b used by a specific item

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

Guest

How do you create a command button that opens up a form that can only be
opened up when it meets a specific type of project category. I want the
command button to only open the form when I want to enter data into another
table that contains data only for that type of project.
 
Rick,

Presuming that the Project Category is bound to a control on your form, one
way is to disable the button by default and enable it when the category has
the special value:

If Me![txtProjectCategory] = YourValue Then
Me![YourCommandButton].Enabled = True
Else
Me![YourCommandButton].Enabled = False
End If

Place the code in the Project Category AfterUpdate event and the form's
OnCurrent event.

Alternatively, you could make the decision in the button's OnClick procedure:

If Me![txtProjectCategory] = YourValue Then
...open form here
Else
MsgBox "This form only applies when Project Category equals 5."
End If

Hope that helps.
Sprinks
 

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