I have a command button on each record of a multiple item form. I need to disable the command button on some but not all records based on data on a field on that record. Is this possible?
I have a command button on each record of a multiple item form. I need to disable the command button on some but not all records based on data on a field on that record. Is this possible?
SURE! Just put code in the Current event of the form to check the value of the control and enable/disable the command button. Just make sure some other control has the focus because you can not disable a control with the focus.
This isn't working quite like I thought it would. When I use code to make the command button not visible, it made all the command buttons invisible at the same time once I tabbed to the line that triggered the visible = False. Also, the OnCurrent only works when tabbing through the records. When the form refreshes or opens up, I would like to see the Command Button appear only on the lines where Status = "A". I tried the OnPaint also and
I should have read your original post more carefully. It looks like you have a form in Continuous Form mode. As such, Conditional formatting does not work on Command Buttons. You also said disable and not make invisible. You can make sure the Command Button does not do anything if a control on that record contains certain data if you want.
I currently have code that displays an error message when clicking on the command button on thosse records that I was hoping to disable or make invisible. I tested your solution using visible = false instead of disabling. I was hoping to avoid displaying the command button on those records that require no further action.
Can you think of any other workaround? I might try making it a single form but have the form only .3" high to see if it will give the look of a continuious form. This should then allow me to make the command buttons visible or invisible. Don't know if this will even work but work trying just for kicks.
It looks like you are having a lot more success that I would in the same situation. That's great!