Multiselecting

Benjamin Bolduc

Registered User.
Local time
Today, 06:58
Joined
Jan 4, 2002
Messages
169
Multiselecting Woes- Please help

Hi Everyone!

I designed a form a long time ago that has been working great ever since. Bascially I can double-click an item in a list and it will bring up a form based on the supplier of that item. Right now it will show everything associated with that supplier.

As our company is growing, Im finding it more and more agitating to sift through this form as there can now be like 50 items per supplier. So I figured if I used the mulitselect feature to bring up the form with just those items that I select, instead of everything from thier supplier, Ill have just what I need.

One problem with this: I can't figure out how to do it!
Here's a sample of the code that is currently running these forms:


Private Sub InvList_DblClick(Cancel As Integer)

Dim stWhere As String
stWhere = "[Supplier]='" & Me.InvList.Column(1) & "'"
DoCmd.openform ("POBuilder"), , , stWhere, acFormEdit



The primary key for these items is the [UPC#] in Me.InvList.Column(0). I'm figuring I can incorperate some sort of Multi-Select feature based on this UPC# to bring up just the selected items. Does anyone have any ideas or suggestions regarding this? By the way, I tried MS Access Help and searching through this sites archives to no avail.

Thanks in advance everyone! You guys are the best! :)

-Ben
 
Code similar to this in a Multi-Select list box should do what you want:

Dim varItem As Variant
Dim strWhere As String

For Each varItem In Me![InvList].ItemsSelected
strWhere = strWhere & "UPC# =" _
& Chr(39) & Me![InvList].Column(0, varItem) & Chr(39) & " Or "
Next varItem

strWhere = Left(strWhere, Len(strWhere) - 4)

DoCmd.OpenForm "POBuilder", , , strWhere, acFormEdit

Change the control and field names as necessary. Be sure the Multi Select propert is set to Simple.

hth,
Jack
 
Perfect! all I had to do is put brackets around the [UPC#] and it worked like a charm.

Thank you so much for your help :)
 

Users who are viewing this thread

Back
Top Bottom