Jake said:
Hi there
I think I have found a simpler way of approaching this, but still need some
assistance !!
I have a form, just one form.
The user selects a value from a combo box ("office")
The user then selects one of 2 option buttons (labelled as "Current" and
"Next", which hold values 1 and 2 respectively)
The user then selects any number of records from a listbox (these are
customer surnames)
When the user clicks on my 'Print' button, I have a messagebox appear which
states some standard narrative.
What I wish the messagebox to say is something like this:
"You are about to print 9 customer records for the 'Current' week for the
London office"
(Where 9 is the number of records selected in the listbox, 'Current' is the
option button selected and 'London' is the office selected in the combobox)
Many thanks for your help
Rather than a msgbox, I'd just add a control to your form that shows how
many records the user has selected in the list box. If you want to make
it really user-friendly, you could make it a locked & disabled text box
which is long enough to hold the entire sentence you wanted to display
in the msg box. The message box isn't a very useful way to present the
info because it requires additional input from the user; better to give
the user enough info to fully evaluate clicking the print button in the
first place.
Look through the documentation for the list box property that will
return the number you want (I don't know it offhand); then it's just
Me.Controls("SelectedSurnames") = lbx.NumberSelected
or
Me.Controls("LongSentenceTextBox") = _
"You are about to print " & _
Me.Controls("list box name").NumberSelected & _
" customer records for the '" & _
Me.Controls("option box name") & _
"' week for the " & _
Me.Controls("combo box name") & " office"
in the appropriate event handlers. I'd opt for the first; less
involved; just put it in the list box's click event or after_update
event. If you must have the latter, create a separate subroutine, name
it something nice, and then call the nice name in the after_update
routines of all three controls.
Hope this is helpful
spark