Combo column in query criteria

J

John

I have a combo query in Combo2 that needs to use the column value from
Combo1 as a criteria.
[Forms]![frmAttendees]![frmAttendeeEvents].[Form]![Building].Column(2)

This causes an undefined function error in Access 2003 for
'[Forms]![frmAttendees]![frmAttendeeEvents].[Form]![Combo1].Column'
so it appears as though it's not picking up the Column number, or dropping
it during parsing.

Can I use Col(2) as a criteria, and what would be the proper syntax?

I would prefer not to have to capture the Col(2) value.

Thanks,
John
 
D

Douglas J Steele

You sure that the name of the container on frmAttendees that holds the
subform is named frmAttendeeEvents?

If you created the subform by dragging frmAttendeeEvents onto frmAttendees,
the name of the subform container is probably the same as the name of the
form being used as a subform (but not always). If you created the subform by
dragging a subform control from the tool box onto frmAttendees and then
filled in its properties (using either the wizard or doing it manually), the
subform control is probably named something like Child0.
 
G

Guest

I don't believe queries can accept a column reference from List Boxes or
Combo Boxes. If you want to referece an unbound column is a query, and you
don't want to use a hidden text box on your form that has the combo box's
column(2) value as it's control source, the only other option I can think of
would be to put a function in a standard module that will read the value in
the column and pass it to the caller. then call the function in your query.
 
J

John

Douglas,
Yes, the address is correct.
Main form frmAttendees, sub frmAttendeeEvents, Combo = Building with 3
columns, all visible.

I realize now that the Building table behind the combo has no key field, so
most probably the value in column 2 wouldn't be legitimate for the
particular Building and Room originally chosen in Combo1. So I'm going to
link Combo2 by just the "bound" Building field, and drop the Column(2)
reference.

But, even if Column(2) had a bogus value, the query criteria shouldn't drop
the (2) from Building.Column(2). Right now, I'm imclined to agree with
Klaatu, that Access might not allow and unbound column in a combo to be
referenced by the Combo2 query.

Thanks for you help,
John

Douglas J Steele said:
You sure that the name of the container on frmAttendees that holds the
subform is named frmAttendeeEvents?

If you created the subform by dragging frmAttendeeEvents onto
frmAttendees,
the name of the subform container is probably the same as the name of the
form being used as a subform (but not always). If you created the subform
by
dragging a subform control from the tool box onto frmAttendees and then
filled in its properties (using either the wizard or doing it manually),
the
subform control is probably named something like Child0.


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


John said:
I have a combo query in Combo2 that needs to use the column value from
Combo1 as a criteria.
[Forms]![frmAttendees]![frmAttendeeEvents].[Form]![Building].Column(2)

This causes an undefined function error in Access 2003 for
'[Forms]![frmAttendees]![frmAttendeeEvents].[Form]![Combo1].Column'
so it appears as though it's not picking up the Column number, or
dropping
it during parsing.

Can I use Col(2) as a criteria, and what would be the proper syntax?

I would prefer not to have to capture the Col(2) value.

Thanks,
John
 
J

John

Klatuu,
I realize now that the Building table behind the combo has no key field, so
most probably the value in column 2 wouldn't be legitimate for the
particular Building and Room originally chosen in Combo1. So I'm going to
link Combo2 by just the "bound" Building field, and drop the Column(2)
reference.

And, I'm inclined to agree with you, and that's what I needed to know.
Access does not seem to be able to parse or understand the
Building.Column(2) in the Combo2 query. It thinks it's a function of some
sort.

Thanks for your help,
John

Klatuu said:
I don't believe queries can accept a column reference from List Boxes or
Combo Boxes. If you want to referece an unbound column is a query, and
you
don't want to use a hidden text box on your form that has the combo box's
column(2) value as it's control source, the only other option I can think
of
would be to put a function in a standard module that will read the value
in
the column and pass it to the caller. then call the function in your
query.

John said:
I have a combo query in Combo2 that needs to use the column value from
Combo1 as a criteria.
[Forms]![frmAttendees]![frmAttendeeEvents].[Form]![Building].Column(2)

This causes an undefined function error in Access 2003 for
'[Forms]![frmAttendees]![frmAttendeeEvents].[Form]![Combo1].Column'
so it appears as though it's not picking up the Column number, or
dropping
it during parsing.

Can I use Col(2) as a criteria, and what would be the proper syntax?

I would prefer not to have to capture the Col(2) value.

Thanks,
John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top