473,424 Members | 1,856 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,424 software developers and data experts.

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,EmployeeNr from tblOrders
ZipCode,City from tblZipCodes
Name,Adr,ZipID from tblCustomers
OrderNr,ItemID,Amount,Price,Discount 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,tblCustomers,tblItems,tblOrderDetails and tblZipCodes.

Any suggestions?

Me.Name
Nov 13 '05 #1
2 4553
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.google.c om...
Hi!

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

Items will include:

OrderNr,Date,EmployeeNr from tblOrders
ZipCode,City from tblZipCodes
Name,Adr,ZipID from tblCustomers
OrderNr,ItemID,Amount,Price,Discount 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,tblCustomers,tblItems,tblOrderDetails 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.Requery

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
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...
8
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...
1
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. ...
2
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,...
2
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...
2
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....
2
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...
1
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...
4
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...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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...

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.