Re: Using combo box selection to supply criteria for query
- From: Mr. B <draccess@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 16 Sep 2009 14:20:01 -0700
Try first assigning the value from your combo box to a variable. I realize
that I will work using just the reference to the control, but when you
already have an issue with the correct syntax it makes it a little simpler to
just declare a variable and assign the value from the combo box to it.
dim strRegion as String
strRegion = [Forms]![Main Form]![Region Select]
then use the variable in your sql statement as:
Like """ & strRegion & "*""
Later if you want to come back and just use the reference to the control,
you still can do that.
-----
HTH
Mr. B
http://www.askdoctoraccess.com/
Doctor Access Downloads Page:
http://www.askdoctoraccess.com/DownloadPage.htm
"Erick C" wrote:
No luck..
I even tried putting the wildcard on both ends and it still did not
work:
Like "*" & [Forms]![Main Form]![Region Select] & "*"
and I tried:
Like [Forms]![Main Form]![Region Select] & "*"
And the Region is only a one letter designation coming from the select
query, so there is not a lot of stuff that is being brought into the
combo box, just single letters.
On Sep 16, 2:52 pm, KARL DEWEY <KARLDE...@xxxxxxxxxxxxxxxxxxxxxxxxx>
wrote:
Try this --
Like [Forms]![YourFormName]![Combo22] & "*"
If nothing is selected in the combo then it is the same as selecing all.
--
Build a little, test a little.
"Erick C" wrote:
I am hoping someone can help me out with a problem that I am having.
I am setting up a database that will serve as an archive for our
reporting results. I am jsut starting to get everything together, so
I can modify anything if necessary. I made a form that has six
different combo boxes along the top. The data sources for the combo
boxes are different, some have names that I manually added. Other
boxes use select queries that I set up pulling data from certain
tables as data sources, since using the tables themselves yielded
duplicate results (the same region is listed multiple times in one
table).
In the end I want to set up buttons for various reports, and the
results will be driven by the combo box selections made on the forms.
I tried setting up a test select query, and it works for the most
part. 5 out of the 6 combo boxes will yield results if they are
selected by themselves, but one combo box will only filter the query
results when it is used in conjunction with another combo box.
It was pretty messed up setting up the query, since I had to set up a
line of criteria for each possible combination that the combo boxes
could be selected, or not selected, meaning I have 32 rows of
criteria. I can post my SQL view, but it is around 3 pages long whan
I copy it to Word
Any help I can get, or any suggestions on how I can set up my filters
so they will work better, more efficiently, I would be very grateful.
Erick- Hide quoted text -
- Show quoted text -
- References:
- Using combo box selection to supply criteria for query
- From: Erick C
- RE: Using combo box selection to supply criteria for query
- From: KARL DEWEY
- Re: Using combo box selection to supply criteria for query
- From: Erick C
- Using combo box selection to supply criteria for query
- Prev by Date: Re: This Recordset is not updatable?
- Next by Date: RE: Using combo box selection to supply criteria for query
- Previous by thread: Re: Using combo box selection to supply criteria for query
- Next by thread: Re: Using combo box selection to supply criteria for query
- Index(es):
Relevant Pages
|