enabling buttons...

  • Thread starter thewabit via AccessMonster.com
  • Start date
T

thewabit via AccessMonster.com

Thanks for all good help you guys offer!

I have a listbox form that displays a list used for multiple reasons. I.E. it
lists templates and you can select them to be modified, to view a summary,
etc. This listbox is launched from other forms.
Question: Is there a way to have multiple buttons on this list box but only
enable certain ones depending on which form launched it?
 
T

Tom Wickerath

Hi wabit,

I've never heard of having buttons on a list box, but you can certainly have
buttons on a form. Yes, these could be enabled depending on which form
launched it by using the optional OpenArgs parameter in the DoCmd.OpenForm
statements in each calling form. You would then use code in the form that is
opened, in the Form_Open event procedure, to inspect the value of the
OpenArgs statement if not null. You can use a Select Case....End Select
construct to conditionally enable/disable command buttons based on the
OpenArgs value.


Tom Wickerath
Microsoft Access MVP
http://www.accessmvp.com/TWickerath/
__________________________________________
 
T

thewabit via AccessMonster.com

Tom,

Thanks for the reply. I guess I should have stated that better. It is a form
with a listbox on it and buttons at the bottom to open other forms and
populate it with the data selected in the list box (or data the list box item
represents).

I have successfully used the openargs to do this however my delemma now is
the 1st form has buttons (which now I am learning aren't buttons) that have
been programmed to launch the 2nd form (the one with the listbox). Depending
on the item clicked on the first form determines which button on the 2nd form
will enable. So the point is...

Question 1...Do I send the form name AND the selectable item name (button) in
open args and how?

Question 2...How do I determine what the name of that selectable item is
because right now they are named "Label408, Label409, etc. I don't think
those are buttons.

Thanks!

Tom said:
Hi wabit,

I've never heard of having buttons on a list box, but you can certainly have
buttons on a form. Yes, these could be enabled depending on which form
launched it by using the optional OpenArgs parameter in the DoCmd.OpenForm
statements in each calling form. You would then use code in the form that is
opened, in the Form_Open event procedure, to inspect the value of the
OpenArgs statement if not null. You can use a Select Case....End Select
construct to conditionally enable/disable command buttons based on the
OpenArgs value.

Tom Wickerath
Microsoft Access MVP
http://www.accessmvp.com/TWickerath/
__________________________________________
Thanks for all good help you guys offer!
[quoted text clipped - 3 lines]
Question: Is there a way to have multiple buttons on this list box but only
enable certain ones depending on which form launched it?
 

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

Top