Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a de facto control array

Status
Not open for further replies.

Quehay

Programmer
Feb 6, 2000
804
US
On a user form I wanted to offer a group of command buttons <br>offering preview, print, or email for a list of reports.<br><br>Since there is no index on command controls and I can't find any refence to control arrays, I assume you can't overtly create one in Access.&nbsp;&nbsp;I thought I was clever using a defacto index in the tag property.&nbsp;&nbsp;Then, when it came time to starting writing event code I realized that there would be separate&nbsp;&nbsp;click events for each button (there are 18).&nbsp;&nbsp;I was hoping to have one Select Case for the whole set within one event.&nbsp;&nbsp;I guess the routine could be written as a function in a Standard Module and called x number of times, but this is still pretty redundant.<br><br>The multibutton interface is a good format for the user so I'd like to keep it.&nbsp;&nbsp;Any hints on the array solution?<br><br>Thanks!
 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Even with the array, you would still end up doing just about as much work.&nbsp;&nbsp;Granted, it would be much easier to go back to and look at later when it's just one event, but it may not be worth the hassle.&nbsp;&nbsp;You could like you said write a function that gets called whenever someone clicks a button and passes it's name along to that function, but the case statement would be just as much of a pain in the ass as the separate events.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;I can understand your want to keep things compact and neat, I have the same problem, but I think sometimes you just have to take what you can get. Afterall, it will work just as well split into 18 onClick events me thinks..=]&nbsp;&nbsp;Good luck. <p>xtreme1<br><a href=mailto:rbio@excite.com>rbio@excite.com</a><br><a href= > </a><br>
 
I may not be understanding but is this what you had in mind?<br><FONT FACE=monospace><br>Report name 1&nbsp;&nbsp;&nbsp;{Print} {Preview} {EMail}<br>Report name 2&nbsp;&nbsp;&nbsp;{Print} {Preview} {EMail}<br>Report name 3&nbsp;&nbsp;&nbsp;{Print} {Preview} {EMail}<br>Report name 4&nbsp;&nbsp;&nbsp;{Print} {Preview} {EMail}<br>...<br>{OK} {Cancel}<br></font><br>The user selects {Print} for the first report and {Preview} for report 3, then clicks the {OK} button?<br><br>You want to check each set of buttons (toggle or radio groups?).<br><br>If you named the controls Print1, Print2, etc.<br><br>You can refer to them in a loop...<br><br>If Me(&quot;Print&quot; & i) = True then ... <p>Jim Conrad<br><a href=mailto:JimConrad@Consultant.com>JimConrad@Consultant.com</a><br><a href= > </a><br>
 
xtreme: Thanks for the solidarity!<br>Jim: You got the layout right.&nbsp;&nbsp;Thanks for a good idea.&nbsp;&nbsp;The<br>easiest is to use radio buttons in an option group and that's probably what I'll end up doing.&nbsp;&nbsp;My thinking vis a vis the command buttons was that from a user perception standpoint the command button has a more intuitive &quot;do something now&quot; feel than the &quot;olives, anchovies, or mushrooms&quot; sense that the option groups do.&nbsp;&nbsp;Code simplicity<br>wins the day though!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top