Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Use Combobox column in Query

1,623 views
Skip to first unread message

Ripper

unread,
Aug 6, 2009, 11:42:01 PM8/6/09
to
I am attempting to use the column property of a combo box in a filter without
success. I use the following in the criteria of a name field...

BETWEEN [forms].[frmMainAdmin-Alpha].[lstFilter].[Column1] AND
[forms].[frmMainAdmin-Alpha].[lstFilter].[Column2]

The combo box has 3 fields: AlphaTitle (the title of the record), AlphaStart
(A text field with the value of "A*", and AlphaEnd (A text field with the
value of "Kz*")

It keeps asking me for the parameter values of columns 1 and 2. What am I
doing wrong?
--
Thanks As Always
Rip

Duane Hookom

unread,
Aug 6, 2009, 11:54:01 PM8/6/09
to
One solution is to add an invisible text box to your form with a control
source like:
=lstFilter.Column(1)
Then use the text box in your query criteria.

--
Duane Hookom
Microsoft Access MVP

Ripper

unread,
Aug 7, 2009, 12:15:01 AM8/7/09
to
Works perfect. Thanks Duane. Kinda feels like cheating though.

--
Thanks As Always
Rip

Duane Hookom

unread,
Aug 7, 2009, 12:29:01 AM8/7/09
to
You could also try wrap the Forms!frm...!cboYours.Column(1) inside Eval()

BETWEEN Eval([forms].[frmMainAdmin-Alpha].[lstFilter].Column(1)) AND
Eval([forms].[frmMainAdmin-Alpha].[lstFilter].Column(2))

Ken Snell [MVP]

unread,
Aug 7, 2009, 10:41:24 AM8/7/09
to
"Ripper" <Rip...@discussions.microsoft.com> wrote in message
news:C5DEAF4C-DE31-4AFE...@microsoft.com...

> Works perfect. Thanks Duane. Kinda feels like cheating though.

It's not cheating. You cannot reference the Column property of a listbox or
combobox from a query. So Duane's method is the right way to do it.

Alternatively, you can use a public function that reads the Column property
from the combobox, and use that function in your query to return the value
to the query.
--

Ken Snell
<MS ACCESS MVP>
http://www.accessmvp.com/KDSnell/

0 new messages