Query criteria problem !!!! Please help

P

Pegawars

I have a combobox with 4 columns.
i want the use the value of column 4 as a criteria in a query.
I used this lines and non of them is working

[Forms]![frm-Name]![combo1.column(3)]

[Forms]![frm-Name]![combo1].[column(3)]

[Forms]![frm-Name]![combo1]![column(3)]

When i put the value first in a txtbox and i use that value from the
txtbox it's working fine.

[Forms]![frm-Name]![txtbox1]

What am i doing wrong?

Please help.

Thanx
 
K

Ken Snell

Queries cannot "see" any column in a combo box or list box except the bound
column (because the bound column is the value of that control).

Create a public function that gets the value of the column you want and
returns it to the query. For example, in your query, replace the
[Forms]![frm-Name]![combo1].[column(3)] reference with this:

GetMyColumnValue()

Create a public function in a regular module (name the module basFunction):

Public Function GetMyColumnValue(lngColumnNumber As Long) As Variant
GetMyColumnValue = Forms]![frm-Name]![combo1].Column(3)
End Function
 

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

Similar Threads


Top