Showing listbox values in msgbox (1 Viewer)

gazsharpe101

Registered User.
Local time
Today, 20:37
Joined
Oct 23, 2007
Messages
47
Hi again, I have got 4 separate listboxes on a report and dependant on the content of the report, I wish to display a message box to inform the user of data inaccuracies that are appearing on the report.

Basically, when the report is loaded, it runs a query and fills the listboxes if certain criterion are met. So, what I want is if the lists get filled then to message box the user with the contents of the 4 list boxes (which as I have said are filled with the correct criteria) next to each other with a message above it. I'm not sure if this can be done by combining the 4 list boxes into a combo box or what I have no idea.

Thanks for your help.
Gareth.
 
Last edited:

NickH1

Registered User.
Local time
Today, 20:37
Joined
Oct 30, 2007
Messages
18
Show listbox values in msgbox

Msgbox cannot show anything other than text (unless you get really clever with APIs) . You can put lists usng linebreaks but you will have trouble getting columns to line up.

I'm not quite sure what you want but why not create a form that has the same listboxes on it as the report has. Fill the form in the same way you fill the report and open the form after the report has opened. You can layout the form how you like and write any messages you want anywhere. You can make it act like a message box by making it a pop-up form and you can stick an OK button on for the user to close it.
 

gazsharpe101

Registered User.
Local time
Today, 20:37
Joined
Oct 23, 2007
Messages
47
Hi, thanks for your reply.

How do I go about putting line breaks in etc? I'm not too bothered about the columns lining up really. Also, just out of curiousity what are API's?

Thanks again.
Gareth.
 

NickH1

Registered User.
Local time
Today, 20:37
Joined
Oct 30, 2007
Messages
18
In msgbox do
Msgbox "My first line of text" & vbcrlf & "My second line of text"
vbCrLf puts in a line break.
APIs are Windows low level functions. To write on a MsgBox you would have get directly to the window 'handle' and then use draw routines - basically to do it the way Access does it. I mostly 'borrow' routines that use it. I use a good one which lets you change the text on a msgbox so you can have "Press Me" instead of OK or "Option 1" and "Option 2" instead of "OK" and "Cancel"
 

gazsharpe101

Registered User.
Local time
Today, 20:37
Joined
Oct 23, 2007
Messages
47
Is there anyway I can assign each line of a text box to a variable and add it to a messagebox that way? I can't think of any other way to do it really that I am able to do. What other options do I have when dealing with the values in my listbox? Can I copy them to a multiline text box and use them in my messagebox or something like that?

Thanks.
Gareth.
 

NickH1

Registered User.
Local time
Today, 20:37
Joined
Oct 30, 2007
Messages
18
Not sure what you are trying to achieve, I'm afraid. Anything can be shown in a msgbox as long as you convert it to a string (up to a character limit of 255 though!) You can pull lines out of a listbox easily but separating lines from a multi-line textbox is harder. It still sounds like using a form as a msgbox is the best idea.

Nick
 

gazsharpe101

Registered User.
Local time
Today, 20:37
Joined
Oct 23, 2007
Messages
47
How do I get the items out of the list box? What would you recommend I do to have another form as a message box?

What happens is, the user runs a report that is based on a parameterised query. When they run this report, they have to input a parameter which obviously defines what the query returns and hence what the report will show. With the way the report works, it is possible that there may be slight inaccuracies with what is displayed on the report, but this is due to information on the database being incorrect. So, what I want to happen, is when the report is run, a message box appears saying if the figures on the report don't quite add up then it is due to an error on the database and that the user can still see the report but if they want it to be 100% accurate then they need to correct it themselves because I am not in a position to make any assumptions on their behalf.

I have 4 lists in the report header (although it doesn't matter where they are really), and these all get filled using SQL statements which are all variants of the query on which the report is based (so in essence it runs the query again but filters out information based on certain values - the information that is filtered out are the database inaccuracies).

So I want a box to show up and saying something like "please be aware that for the following cases, some information in relation to what is being displayed on this report is incorrect, this will need to be corrected to ensure 100% accuracy on this report".

I hope this helps to explain a little bit more about what I want.

Thanks.
Gareth.

Thanks for taking the time to help :)
Gareth.
 

Users who are viewing this thread

Top Bottom