Query criteria problem !!!! Please help

  • Thread starter Thread starter Pegawars
  • Start date Start date
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
 
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
 
Back
Top