Re: Multiselect listbox parameter query followup
- From: "Michel Walsh" <vanderghast@VirusAreFunnierThanSpam>
- Date: Mon, 12 Jun 2006 17:47:05 -0400
Hi,
The easier way would be to create the WHOLE query as a string, form the
SELECT up to the WHERE clause your code produces. With that single string,
representing a valid SQL statement, you can use it as record source (form,
sub-form, report), or as row source (list box, combo box) as if it was a
saved query. Just be sure the string is a valid SQL statement: Debug.Print
it in the immediate debug window, then, paste it in the SQL view of a new
Query. That new query should then run (to see data in data view) without
producing any error.
Hoping it may help,
Vanderghast, Access MVP
"Dave Twombly" <dtwombly@xxxxxxxxx> wrote in message
news:1149103122.181306.292220@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I'm trying to make a multiselect listbox provide one or more parameters
for a query. I've found useful code for concatenating the items
selected in the list box at
http://www.mvps.org/access/forms/frm0007.htm, but I don't know how to
make my query read that string as its parameter. The website says this:
"Note: You can still use a parameterized query provided you pass the
entire Where clause to it via code as a parameter. (eg. Have the query
reference a hidden control to which you manually assign the complete
WHERE clause using the following logic...[Code begins])"
What I don't know how to do here is assign the WHERE clause that the
code produces to a control on my form. I assume that once that's done I
simply refer the query condition to the control, much as if it were a
single-select listbox.
Would someone please help me complete these final steps of getting the
query to accept the string as one of its parameters?
(Incidentally, I found a helpful way to do this for reports on
http://allenbrowne.com/ser-50.html, but I can't make that method work
for a query.)
Thanks,
Dave
.
- Prev by Date: Re: Grouping to get Max Value of Sub Group
- Next by Date: Re: Overflow
- Previous by thread: Re: Grouping to get Max Value of Sub Group
- Next by thread: Re: Multiselect listbox parameter query followup
- Index(es):
Relevant Pages
|