473,782 Members | 2,439 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Sending selected items from listbox to report

Hi!

From a listbox I'd like to send only selected items to a report.

Items will include:

OrderNr,Date,Em ployeeNr from tblOrders
ZipCode,City from tblZipCodes
Name,Adr,ZipID from tblCustomers
OrderNr,ItemID, Amount,Price,Di scount from tblOrderDetails
ItemName from tblItems
Must I make a SQL in code in order to obtain this?

All data in listbox will be retrieved from underlying tables,

tblOrders,tblCu stomers,tblItem s,tblOrderDetai ls and tblZipCodes.

Any suggestions?

Me.Name
Nov 13 '05 #1
2 4620
Easy enough to use one value from the list box to filter your report, but
not sure how practical it is for multiple selections. Commonly, apps use
two approaches.
1. A continuous form with a checkbox to select each desired record for
the report, or..

2. A pop-up form with an unbound form whose unbound controls are used as
the criteria parameters for the report's underlying query.

Either one will result in a filtered record source for your report.

-Ed

"Geir Baardsen" <ge***********@ hotmail.com> wrote in message
news:35******** *************** ***@posting.goo gle.com...
Hi!

From a listbox I'd like to send only selected items to a report.

Items will include:

OrderNr,Date,Em ployeeNr from tblOrders
ZipCode,City from tblZipCodes
Name,Adr,ZipID from tblCustomers
OrderNr,ItemID, Amount,Price,Di scount from tblOrderDetails
ItemName from tblItems
Must I make a SQL in code in order to obtain this?

All data in listbox will be retrieved from underlying tables,

tblOrders,tblCu stomers,tblItem s,tblOrderDetai ls and tblZipCodes.

Any suggestions?

Me.Name

Nov 13 '05 #2
"Geir Baardsen" <ge***********@ hotmail.com> wrote
From a listbox I'd like to send only selected items to a report.


You haven't explained completely what you intend to do, but if I understand
correctly, you will have a listbox that has as its rowsource an SQL query
that brings together several tables; your listbox is a multi-select listbox,
and you want to make multiple selections; you want to print the select
records, which are rows from your listbox.

If the above is correct, one way to do this would be to use your original
SELECT query to fill a table - I'll call it qryFillTable.

a. Create the table with the fields you want from your query. You can also
create a "Make Table" query out of your original query using the Query
Designer to do the work automtically. I'll call it tblListBox.

b. Add a field to the end of the table, a yes/no field, "Selected"

c. Change the rowsource of the listbox to the table name

d. When you open your form, run three statements:

DoCmd.RunSQL "DELETE * FROM tblListBox"
DoCmd.RunSQL "INSERT INTO tblListbox SELECT * FROM qryFillTable"
myListBox.Reque ry

Your listbox is now filled with your query, plus you have an "extra" field
in your table, 'Selected'. Each time that you select a row in the listbox,
set the selected field to True. When you are ready to print your report,
use as your recordsource "SELECT * FROM tblListBox WHERE Selected=True"
Darryl Kerkeslager
Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
22627
by: Peter Moscatt | last post by:
I am having trouble understanding the methods for the Listbox from Tk. If I was to select at item in the list using a mouse click (have already created the bind event) - what method returns the text of the selected item ? Pete
8
2844
by: Vipin Kedia | last post by:
Hi I have written a code for showing the list boxes as selected using a Listitem and the selected property of the items. Now I have 2 list boxes in my page. But it shows only the selected values of the last list box in both the list boxes. If i reverse the calls to the filllistbox methods it shows the value selected for the 1st list box in both the listboxes. I have the code for my method below. Is there a way I can solve this problem?
1
528
by: Geir Baardsen | last post by:
Hi! To Darryll Kerkeslager: Sorry..Something seems to happen when trying to answer your comment. U did understand it right. Of course I'll have an underlying query with the same fields. However on the popupform, I'll have three listboxes:
2
19431
by: JP | last post by:
Hi, I am trying to loop through the listbox and read the selected items from the list, within a CLICK event on an aspx page. The following is what I have tried. It loops through the listbox, but none of the items' SELECTED property is TRUE while I have selected a few items. What am I missing? Dim strFunds As String
2
2704
by: Srimadhi | last post by:
Displaying selected items at the top of the listbox Hi, I am having two listboxes - one with ids and second with the related names. When user selects an item in one listbox, the corresponding item will be selected in the second listbox too. The problem is, when the user selects an item and it is in the middle of the list, the user is not able to know whether it is selected or not. Is there a way to display all the selected items...
2
2761
by: John | last post by:
I have a listbox that is databound when my form loads. A user can then select and option using a drop down box. When the user selects an option the corresponding items in the listbox gets selected. How can I show those selected items at the top of my listbox. The issue is when the user selects an item and it is in the middle of the list, the user is not able to know an item it is selected or not unless they scroll through the listbox.
2
4089
by: Hitesh | last post by:
I have a listbox and the values get selected (highlighted) from code. I can highlight the corresponding list box items, but they do not show in the listbox I have to scroll through the list box to find them. How can I setFocus on the highlighted data items in the listbox after they are highlighted. The selection mode is set to multiple for the listbox -- Thanks
1
2562
by: chinkyk | last post by:
I have a form that has a list box(multiple values selected) and multiple report names(when clicked on the button, it will run the report) on the form. I have selected multiple items from the list box. Now I want to use the listbox selected items, in the reports query. All the reports have a query attached to it. So I want to use the selected items from the list box in the query, in the In clause of the query. Please help.
4
6140
by: rn5a | last post by:
I am binding a DropDownList with records existing in a database table. I want to add an extra item *SELECT COMPANY* at index 0 so that by default, it gets selected. This is how I tried it but the extra item just doesn't get added to the DropDownList: ============================================= <script runat="server"> Sub Page_Load(..........) Dim dSet As DataSet Dim sqlConn As SqlConnection
0
9639
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9479
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10146
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8967
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7492
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6733
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5378
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4043
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 we have to send another system
2
3639
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.