View Single Post
  #2  
Old May 25th, 2010, 09:07 PM posted to microsoft.public.access.queries
xps35
external usenet poster
 
Posts: 22
Default Parameter queries that allow users to choose items from a list

=?Utf-8?B?dmVuYWpvZQ==?= wrote:


Dear Access 2007 VBA Gurus,

I have a "Worship Song" database. The tables a
tblWorshipSongs
tblAuthorFirstNames
tblAuthorLastNames
tblCopyrightHolders
tblKeys
tblTempos
tblSongThemes
tblSongTypes

I would like to create parameter queries that allow users to choose their
parameter from a list, preferably the entries from one of the tables. For
example, suppose I wanted to query all the songs by a particular author's
last name. I don't just want users to type in a last name, in which case
they might misspell it and return no records, or type in an entry that is not
already in the table (and again get no records returned). I would like to
limit the user's choices to the last names already in the last names table
and allow the user to choose from a drop-down list of those last names to run
the query. I am a VBA beginner, and I have made a few attempts at this, but
so far, no luck--help!
--
Joe Venable
Virginia Beach, VA


A parameter query is not the right way to do this.

Make a form with an unbound combobox. The rowsource of the combo would
look like:
SELECT DISTINCT LastName FROM tblAuthorLastNames (why first names and
last names in seperate tables?).

In the condition part of a query you can refer to the combo
(forms!yourform!yourcombo).

--
Groeten,

Peter
http://access.xps350.com