Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combobox multiple selection

Status
Not open for further replies.

riny

Technical User
May 15, 2000
32
FR
I have a clients coordinates table (name=&quot;coordinates&quot;) and a report (name=&quot;overview coordinates&quot;) to print a listing.<br>The report gets its data from a query based on the coordinates table extended with some code definitions.<br><br>The listing has become too big, so I made a dialog form with 2 comboboxes, one to select the country, the other to select &quot;client type code&quot;, so that the user can select a limited listing.<br>I added a criteria to the query that &quot;country&quot; and &quot;client type code&quot; must equal the selection on the dialog form.<br>The dialog form has an &quot;OK&quot; button which calls the report.<br>The report heading states the selected country and client type.<br><br>It works fine for a single selection, but my users want to be able to make multiple selections in the comboboxes.<br>I know about the multiple selection property on comboboxes which is exploited using vba, but I can't figure out the vba code to put behind the &quot;OK&quot; button.<br>Could anyone help pls.
 
Where are you calling the Dialog box from?<br>put the code there.<br><br>Like so:<br><br>&nbsp;&nbsp;&nbsp;&nbsp;Dim retval As Variant<br>&nbsp;&nbsp;&nbsp;&nbsp;retval = MsgBox(&quot;Enter something&quot;, vbInformation + vbOKCancel, &quot;Title here&quot;)<br>&nbsp;&nbsp;&nbsp;&nbsp;Debug.Print retval<br>&nbsp;&nbsp;&nbsp;&nbsp;If retval = 1 Then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' user Pressed Ok button<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Print your; Report; here<br>&nbsp;&nbsp;&nbsp;&nbsp;Else<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' retval = 2 user Pressed Cancel<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' dont print report<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Exit Sub<br>&nbsp;&nbsp;&nbsp;&nbsp;End If<br> <p>DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br> Ask me how Bar-codes can help you be more productive.
 
Thank you kindly DougP for your quick response, much appreciated.<br><br>I don't have a problem to launch the report. In fact a button on a switchboard form calls the dialog form (so that the user can set their selection criteria), the report is then launched from an OK button on the form.<br><br>I am set up for a single selection in each combobox.<br><br>There is the possibility for multiple selection in each combobox (holding down ctrl and selecting more than one choice in the combobox) in msacess, which I am not using at present because I don't know how to use it.<br><br>My problem is understanding how to use the multiple selection property on the combobox. From the help files I learn one must do it using vba and the &quot;items selected&quot; property, but I don't understand how to do it for what I want to achieve (the example in the help files is not very helpful for my objective). I can understand it is a matter of indexing from the combolist, but how do I translate that to an applyfilter for the report.<br><br>Maybe I did not present the scenario clearly.<br>Simplified, I have a table of contacts with name, adress, city, and country<br>I want to be able to print a report of contacts, using selection criteria for city and country.<br>For example, get a report listing contacts for city amsterdam,new york, and london (the user sets the single or &quot;multiple&quot; criteria from a combobox).<br>This infers a multiple selection from a choice box of city names.<br>I need to figure out vba code to set selection criteria for the launch of the report.<br><br>Thank you for any further help<br>regards from Monte Carlo,<br>Riny Doyle<br><br>&nbsp;<br><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top