473,499 Members | 1,576 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

MULTILPLE SELECT list box

98 New Member
I would like to know how to use a mulitple selection list box to (1) select tables (2) pull data from each table using a query (3) and append this data to a temporary table to ultimately be used in a report. My guess is that is will look something like this...

do until "listbox number of items selected"
create query with first table selected
append data to temp table
loop
docmd.openreport.......

Thank you to anyone who can fill in my copious blanks!
Feb 9 '07 #1
5 2694
MMcCarthy
14,534 Recognized Expert Moderator MVP
I would like to know how to use a mulitple selection list box to (1) select tables (2) pull data from each table using a query (3) and append this data to a temporary table to ultimately be used in a report. My guess is that is will look something like this...

do until "listbox number of items selected"
create query with first table selected
append data to temp table
loop
docmd.openreport.......

Thank you to anyone who can fill in my copious blanks!
You make it sound so easy. ;)

Truth is what you are talking about I believe is dynamic querying where you allow the users to create their own query though a form. This is actually extremely complicated. My advice is don't go near it. Unfortunately, I won't have the time to assist you with this one as I believe it will get very involved and my admin duties keep me very busy on site. One of the other experts may be willing to help.

However, I would advise ...
  • Think very seriously about tackling this. Is it worth the effort and time?
  • Provide a lot more information than you've done so far about exactly what you are trying to do and why.
    • Why do you need to be able to dynamically choose the table?
    • What is the report for?
    • What kind of data do you need from the tables for the report?
If you still want to go ahead then provide the extra information and if some of the experts decide to help you with this they will probably have a lot more questions as time goes on.

Mary
Feb 11 '07 #2
NeoPa
32,557 Recognized Expert Moderator MVP
I am just posting to register with the thread and keep an eye on it.
INeedaHelp,
Mary is right.
You will frighten off any interested expert by asking a question with such scope. You're almost asking for your whole project to be done for you (I'm sure this is not your intention).
Your best way of getting help is by breaking down your requirements into much smaller and self contained chunks (questions). You will also learn more this way I think.
Feb 11 '07 #3
ineedahelp
98 New Member
I apologize for being so vague. I think what I need is actually quite simple, I just haven't done much with mulitiple selection list boxes. What I am hoping for is after the user has chosen "multiple" tables that I have made available through this statement in the row source of my list box:

SELECT MSysObjects.Name FROM MSysObjects WHERE (MSysObjects.Name Like "LaB*") OR (MSysObjects.Name Like "PAR*") ORDER BY MSysObjects.Name;

I want to run a DO UNTIL loop that will "pull" data from each table if it exists...something like:

Do Until "items selected count" = # of items selected in list
The code I know how to write goes here
Loop

I really only need help with how to loop through the items selected in my multiple selection list box. Sorry for making it look like I wanted someone to write all my code. I'm lazy but not that lazy!!! :)
Feb 12 '07 #4
ineedahelp
98 New Member
I think I figured it out...for anyone who might have the same question, I used the following code to access the items selected in the multiple select list box:

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmbRunSymbolSearch_Click()
  2.     Dim varTable As Variant
  3.  
  4.     For Each varTable In Me.lstChooseTable.ItemsSelected
  5.        Debug.Print Me![lstChooseTable].ItemData(varTable)
  6.        Debug.Print varTable
  7.     Next varTable
Sorry again for the confusion in my first post!
Feb 12 '07 #5
NeoPa
32,557 Recognized Expert Moderator MVP
It's not that we're upset with you. We're just trying to help you to understand how you will get the most benefit from these forums (and make our life easier at the same time).

About your question :
I'm afraid I think it is anything but simple. Working with multiple tables as you're doing implies that the database structure is actually quite wrong. Similar data should not be stored in multiple tables but in a single table with a reference field in the record added to enable the records to be distinguished from each other (See Normalisation and Table structures).

Thank you for posting your solution. That is an attitude we appreciate. Processing the data though, is more complicated than simply finding the table names from your list. It is possible to do, but is laborious and not for the feint-hearted.

If I'm right, you've progressed in your understanding since you first visited this site (TSDN), so I recommend that you try to get to grips with the link I included.
Feb 12 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

0
10153
by: Jan | last post by:
I store sql-commands in a database table. In the first step I get the sql command out of the database table with embedded sql. In the second step I try to execute the command, which i got from the...
3
15601
by: Stewart | last post by:
Dear comp.lang.javascript, I have more than once wanted to manipulate the contents of select boxes dynamically, whilst the boxes contain <optgroup> tags. Manipulation of a select box containing...
5
2375
by: callmebill | last post by:
I'm relatively new to javascript, and I'm trying to decide whether the following (and if so, clues on how to do it): I'd like to create two HTML multiple-select boxes. The first would be a list...
19
3509
by: William Wisnieski | last post by:
Hello Everyone, I have a main form with a datasheet subform that I use to query by form. After the user selects two criteria on the main form and clicks the cmdShowResults button on the main...
2
9905
by: Chris Plowman | last post by:
Hi all, I was wondering if anyone can help me with a really annoying problem I have been having. I made a derived datagrid class that will select the row when a user clicks anywhere on a cell...
4
2250
by: Ian Richardson | last post by:
Hi, The function I've put together below is a rough idea to extend a SELECT list, starting from: <body> <form name="bambam"> <select id="fred"> <option value="1">1</option> <option...
7
16849
chunk1978
by: chunk1978 | last post by:
hello. so i have 2 select menus which add and remove options from a 3rd select menu... it seems, however, that it's not possible to use different select menus to toggle a 3rd, because when an...
4
4380
by: rn5a | last post by:
A Form has 2 select lists. The 1st one whose size is 5 (meaning 5 options are shown at any given time) allows multiple selection whereas the 2nd one allows only 1 option to be selected at a time. ...
1
4008
by: Sunray | last post by:
I have a form called the sales form and i have 2 sets of listboxes So what happens is. i add items form the bottom set of list boxes which are bound to a data base to the top set of list boxes which...
0
7132
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7223
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6899
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5475
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4602
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3103
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1427
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
665
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
302
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.