modify form filter code to work with value fields. (1 Viewer)

Misiek

Registered User.
Local time
Today, 05:43
Joined
Sep 10, 2014
Messages
249
Hello Again,

I am using this code:
http://allenbrowne.com/ser-62.html
works excellent for me, but I need to add a combo with value list (only 2 items) and will be singular selection.

I have type in those 2 values in the cboTaskType row source, and then tried to use this:

Code:
     If Not IsNull(Me.cboTaskType) Then
        strWhere = strWhere & "([tTaskType] = " & Me.cboTaskType & ") AND "
    End If

but then when i run the filter, a popup ask again to enter a value... i don't understand why, if I already selected it in the combo.

Thank you
 

llkhoutx

Registered User.
Local time
Today, 00:43
Joined
Feb 26, 2001
Messages
4,018
strWhere = strWhere & "([tTaskType] = " & Me.cboTaskType & ") AND "

is an incomplete statement. The parentheses are not needed. Specify what comes after the 'AND.' Maybe it somet his like

strWhere = strWhere & "[tTaskType] = " & Me.cboTaskType & " AND [YourColumnName] = " & me,cbiTaskType.column(1)

Note that depending on the data type of the fields being filtered, the referenced cbo columns may have to be enclosed in ' or # marks.
 

jdraw

Super Moderator
Staff member
Local time
Today, 01:43
Joined
Jan 23, 2006
Messages
15,395
As likhoutx says - the whereis incomplete. You could do a Debug.Print strWhere
and see exactly what it contains. Good debugging technique.
 

Misiek

Registered User.
Local time
Today, 05:43
Joined
Sep 10, 2014
Messages
249
What do you mean by "columnname"
If my values were entered into row source of that cbo, there is only one column. I didn't know those can have a name, and here to look for it?
 

Misiek

Registered User.
Local time
Today, 05:43
Joined
Sep 10, 2014
Messages
249
@llkhoutx

I am lost, can you please advice what exactly is "YourColumnName" ??
 

Users who are viewing this thread

Top Bottom