If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Disable/Enable Command Button
Form A has an unbound list box based on a query. When the list box has a
record in it I want a command button called ADD to be disabled and a command button called EDIT to be enabled. When their isn't a record in the list box I would like the ADD command button to be enabled and the EDIT command button to be disabled. Also know that the ADD and EDIT command buttons open up pop forms that will allow the user to either add or edit records. When Form A is closed and reopened I would like the ADD and EDIT command buttons to be enabled or disabled based on the value of the list box. Thank you in advance. -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...forms/200612/1 |
#2
|
|||
|
|||
Disable/Enable Command Button
mdavis via AccessMonster.com wrote:
Form A has an unbound list box based on a query. When the list box has a record in it I want a command button called ADD to be disabled and a command button called EDIT to be enabled. When their isn't a record in the list box I would like the ADD command button to be enabled and the EDIT command button to be disabled. Also know that the ADD and EDIT command buttons open up pop forms that will allow the user to either add or edit records. When Form A is closed and reopened I would like the ADD and EDIT command buttons to be enabled or disabled based on the value of the list box. Thank you in advance. Might I suggest a single button with a caption of Add/Edit and a single form that does both functions? All you have to do is filter on the entry in the ListBox when opening a single form to accomplish both adding and editing. -- Rick Brandt, Microsoft Access MVP Email (as appropriate) to... RBrandt at Hunter dot com |
#3
|
|||
|
|||
Disable/Enable Command Button
Could you give me an example of the code I would use to accomplish this?
Rick Brandt wrote: Form A has an unbound list box based on a query. When the list box has a record in it I want a command button called ADD to be disabled [quoted text clipped - 12 lines] Thank you in advance. Might I suggest a single button with a caption of Add/Edit and a single form that does both functions? All you have to do is filter on the entry in the ListBox when opening a single form to accomplish both adding and editing. -- Message posted via http://www.accessmonster.com |
#4
|
|||
|
|||
Disable/Enable Command Button
mdavis via AccessMonster.com wrote:
Could you give me an example of the code I would use to accomplish this? Use the command button wizard in design view of the form with the ListBox. The wizard options would be... Form Operations - Open Form Name Of the Add/Edit form Open The form and find specific data to display ListBoxName - FieldName That will construct code for the button that uses the DoCmd.OpenForm method with a supplied WHERE aregument that will pre-filter the form being opened to match the value currently selected in the ListBox. When no matching record exists (like when the ListBox is empty) then the form will be opened to the blank NewRecord position ready to add a new record. -- Rick Brandt, Microsoft Access MVP Email (as appropriate) to... RBrandt at Hunter dot com |
Thread Tools | |
Display Modes | |
|
|