Counting records in a MsgBox

J

Jake

Hi there

I wish to display a message box upon the click of a button, which says "You
are about to print x records for y office for week commencing z"

How do I get a messgaebox to display the number of records returned by
myQuery ? (This is x)

Also, y is the selected value of a combo box and z is the selected value of
an option group - how do I code these?

Many thanks

Jake
 
S

sparkane

Jake said:
Hi there

I wish to display a message box upon the click of a button, which says "You
are about to print x records for y office for week commencing z"

How do I get a messgaebox to display the number of records returned by
myQuery ? (This is x)

Also, y is the selected value of a combo box and z is the selected value of
an option group - how do I code these?

Many thanks

Jake

Hi Jake.

Jake, can you give more detail about how you are running the report?
Please post code if you have it. Otherwise a very detailed description.
Some of this is very easy, but some of it really depends on how you
guide the user into running the report.

spark
 
J

Jake

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

Cheers

Jake
 
S

sparkane

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
 
J

Jake

You are a STAR spark

Thanks very much, I will opt for the first option!

Cheers mate

jake
 

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