473,382 Members | 1,078 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,382 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 4542
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...

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.