Criteria from Second Column of Combo

T

Tom Ventouris

I have a combo box Combo1 popluated from a number of queries based on a
selction in another Combo@.

I am using this to run reports filter by the value in Combo1. In some cases,
I need to run reports filtered by the value in the second column of Combo2.

Here's my code:
DoCmd.OpenReport "rptReport", acViewPreview, "",
"[Field1]=[Forms]![FormName]![Combo1].Column (1)", acNormal

I get Runtime Error 3085 - Undefined Function
I suspect my problem is in [Combo1].Column(1)

Any help?
 
M

Maurice

Tom,

I think you should lose the quotes;

DoCmd.OpenReport "rptReport", acViewPreview, "",
"[Field1]='" & [Forms]![FormName]![Combo1].Column (1) & "'", acNormal


When column(1) is a string you should place the quotes after column(1) in
case of a numerical value don't place them there.

hth
 
T

Tom Ventouris

Thank you. That was it.

Maurice said:
Tom,

I think you should lose the quotes;

DoCmd.OpenReport "rptReport", acViewPreview, "",
"[Field1]='" & [Forms]![FormName]![Combo1].Column (1) & "'", acNormal


When column(1) is a string you should place the quotes after column(1) in
case of a numerical value don't place them there.

hth
--
Maurice Ausum


Tom Ventouris said:
I have a combo box Combo1 popluated from a number of queries based on a
selction in another Combo@.

I am using this to run reports filter by the value in Combo1. In some cases,
I need to run reports filtered by the value in the second column of Combo2.

Here's my code:
DoCmd.OpenReport "rptReport", acViewPreview, "",
"[Field1]=[Forms]![FormName]![Combo1].Column (1)", acNormal

I get Runtime Error 3085 - Undefined Function
I suspect my problem is in [Combo1].Column(1)

Any help?
 
K

Ken Snell MVP

Maurice said:
Tom,

I think you should lose the quotes;

DoCmd.OpenReport "rptReport", acViewPreview, "",
"[Field1]='" & [Forms]![FormName]![Combo1].Column (1) & "'", acNormal


When column(1) is a string you should place the quotes after column(1) in
case of a numerical value don't place them there.

Column property for a combo box always returns a string value, regardless of
the data type of the field that is providing the values for a specific
column.
 

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