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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Want to fill a list box with items from a table AND my own values

Status
Not open for further replies.

ahmun

IS-IT--Management
Jan 7, 2002
432
US
I currently have a listbox that is populated with values from a table of City Regions (ie PDX, LAX, SFO, etc.)

I want to be able to list all the regions from the table, as well as include an "All" option.
I'm using this list box as selection criteria to filter a report.

Currently I have the listbox's
Code:
.rowsource
property set to an SQL query (generated by Access' Wizard):
Code:
SELECT [lkpRegions].[txtRegionID], [lkpRegions].[txtRegionName] FROM lkpRegions;

I've tried setting the listbox's
Code:
.RowSourceType
property to "Value List" and listing the values thus:
["All",
Code:
SELECT [lkpRegions].[txtRegionID], [lkpRegions].[txtRegionName] FROM lkpRegions;

- I want to keep all code within the form and the properties of the controls rather than create an actual query.
- And I don't want to include "All" as one of the regions in the table (or is this the easiest solution?)
- And I want to avoid simply typing in all the selections (in the case that more regions are added to the table, I don't have to update the form every time that happens)

Any ideas, anyone? Earnie Eng
Newbie Access Programmer/DBA
(I just got a job! yay!)
Code:
---------------------------------
If you are born once, you will die twice.
If you are born twice, [i
 
Use this as your rowsource:

SELECT [lkpRegions].[txtRegionID], [lkpRegions].[txtRegionName] FROM lkpRegions UNION Select "All" as Stuff From lkpRegions; "The Key, The Whole Key, and Nothing But The Key, So Help Me Codd!"
 
Thank you.

btw.. cool signature. I heard that quote in one of the DB classes I took recently Earnie Eng
Newbie Access Programmer/DBA
(I just got a job! yay!)
Code:
---------------------------------
If you are born once, you will die twice.
If you are born twice, [i
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top