Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / May 2007

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rick - 23 May 2007 06:46 GMT
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.
Sprinks - 23 May 2007 20:09 GMT
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

> 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.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.