How do I express a combo box column reference in a query criteria?

E

efandango

I want to tell the query that I want a specfic column on a form's combobox.

This is my current criteria:

[Forms]![frm_Runs]![frm_Getrounds].[Form]![cbo_copy_to_new_point]

I want to say it is:

[Forms]![frm_Runs]![frm_Getrounds].[Form]![cbo_copy_to_new_point].Column(2)

but Access reports invalid bracketing. What am I doing wrong?
 
M

Marshall Barton

efandango said:
I want to tell the query that I want a specfic column on a form's combobox.

This is my current criteria:

[Forms]![frm_Runs]![frm_Getrounds].[Form]![cbo_copy_to_new_point]

I want to say it is:

[Forms]![frm_Runs]![frm_Getrounds].[Form]![cbo_copy_to_new_point].Column(2)

but Access reports invalid bracketing. What am I doing wrong?

Actually, that's Jet that does not recognize that syntax.

Create a little public function in a standard module to get
the column's value:

Public Function MyGetCol(N As Integer)

MyGetCol=Forms!frm_Runs!frm_Getrounds.Form!cbo_copy_to_new_point.Column(N)
End Function

Then you can use MyGetCol(2) in your query.
 
E

efandango

Thanks Marsh,

That worked a treat!

was that the quick and dirty way, or is there a way without having a public
function?

regards

Eric

Marshall Barton said:
efandango said:
I want to tell the query that I want a specfic column on a form's combobox.

This is my current criteria:

[Forms]![frm_Runs]![frm_Getrounds].[Form]![cbo_copy_to_new_point]

I want to say it is:

[Forms]![frm_Runs]![frm_Getrounds].[Form]![cbo_copy_to_new_point].Column(2)

but Access reports invalid bracketing. What am I doing wrong?

Actually, that's Jet that does not recognize that syntax.

Create a little public function in a standard module to get
the column's value:

Public Function MyGetCol(N As Integer)

MyGetCol=Forms!frm_Runs!frm_Getrounds.Form!cbo_copy_to_new_point.Column(N)
End Function

Then you can use MyGetCol(2) in your query.
 
M

Marshall Barton

efandango said:
That worked a treat!

was that the quick and dirty way, or is there a way without having a public
function?


The only other reasonable way I can think of is to use a
text box on the form with the combo box's column value and
reference the text box in the query's criteria. Of course,
if you already have that text box, then using it is less
cumbersome.
 

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