Criteria Problem? (1 Viewer)

thudson

Old Programmer
Local time
Today, 23:55
Joined
Apr 29, 2011
Messages
68
I have a database that i have used for many years, which I use to analyse my bank statement which is in an Excel file. The query uses some code which uses a Combo box to look at a particular category to analyse.
Here is the code:
Code:
Public Function fCboSearch(vCboSearch As Variant)

    If IsNull(vCboSearch) Or vCboSearch = "" Then
        fCboSearch = "*"
    Else
        fCboSearch = vCboSearch
    End If
    End Function
In the query I use the following criteria in the Category field to choose the category I wish to analyse:
Code:
Like fCboSearch([Forms]![2018_No2_Frm]![cbo_Cat])
The form shown in the query contains the unbound combo box, which I named cbo_Cat.
The button on the form opens a report which is based on a query, which the criteria was shown above.
My problem is that when I click on the button to open the report, I get a missing Parameter box showing the criteria is in error. I have even used IntelliSense to create the query criteria.
Even more strange is the fact that I also use the same method on another account and it works perfectly.
I am tearing my hair out( I haven't got much left!):banghead:
Can anyone have an idea why it does not work?
 

llkhoutx

Registered User.
Local time
Today, 18:55
Joined
Feb 26, 2001
Messages
4,018
The criteria must be concantenanted by a ", #, or nothing at all, depending on the datatype of the "cbo_cat." If cbo_cat is bound column of the combobox, i.e. column(0), Select the correct column, not just co_cat.
 

Users who are viewing this thread

Top Bottom