modify form filter code to work with value fields.

Misiek

Registered User.
Local time
Today, 00:30
Joined
Sep 10, 2014
Messages
248
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
 
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.
 
As likhoutx says - the whereis incomplete. You could do a Debug.Print strWhere
and see exactly what it contains. Good debugging technique.
 
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?
 
@llkhoutx

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

Users who are viewing this thread

Back
Top Bottom