RE: Help with List box

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



I will start creating this tomorrow. It will be a simple quick database(I
hope). I will have the command button to open a new email and use the code to
prefill it with the list box information. When I get to that point, If Irun
into a situation, I will re-post. I am hoping this will go smooth.

Thank you again one of many times helping me. I will let you know how I make
out.

Thanks!!!

"Klatuu" wrote:

Put the function in the form's module. Usually, you put subs and functions
that are not event procedures at the top of the module After the Option
statments and any Module level variable declarations and before any event
procedures.
I assume you have a command button or some other event where you create the
email and send it. You would call it from there to add it to your message
text.
--
Dave Hargis, Microsoft Access MVP


"Stockwell43" wrote:

Hi Klatuu, thank you for responding.

Do I create a module for this to go in or does this go in the onclick event
of the button for the email? Sorry, I never used a list box before so this is
kind of new to me.

Thanks!

"Klatuu" wrote:

Yes, you can use a multi select list box. Then when you want to create the
email, you can call a function like this and it will return a string of all
the selected items. In this case, the items are separated with commas, so
they would be presented as:
HUD1, Good Faith Estimate, Inspection Report
If you want them to list like thisL
HUD1
Good Faith Estimate
Inspection Report

You can replace the commas with a line feed.

Private Function DocList() As STring
Dim strDocs As String

With Me.MyListBox
For Each varItem In .ItemsSelected
strDocs = strDocs & .ItemData(varItem) & ", "
Next varItem
End With
DocList = Left(strDocs, Len(strWhere) -1)
End Function

So to use it, append it to the text as

strMsgText = strMsgText & DocList

or to get a vertical list

strMsgText = strMsgText & Replace(DocList, ", ", vbNewLine)

--
Dave Hargis, Microsoft Access MVP


"Stockwell43" wrote:

Hello,

I wondering if someone could please help me with a situation. I am asked to
create a database where the user fills in Customer Name and Address and also
select numerous documents needed to complete the loan. Then click a button to
create an email with that information in it. So my questions are the
following:

1. Can I create a list box so the user can select multiple documents say
maybe 8 out 20 instead of one like in a CBO?

2. After they make their selections, can they click a button to open an
email with these selections listed in the email?

I have created an email to pick up information from textboxes but from a
list box especially if numerous selections have made.

Any help would be most appreciated.

Thanks!!!
.


Quantcast