I have set up a search form to retrieve data on a table by adding some unbound controls as suggested by the following very nice tip http://allenbrowne.com/ser-62.html
All the searching controls I set up are working fine except for the one called “search_structure” which is supposed to look at a specific field called “cod_structure” in the table “register”;
in fact the field “cod_structure” is a combobox searching data into another table called “structures” set in the source row of the searching tab by the following sql:
SELECT structures.id_structure, structures.structure, structures.structure_acronym FROM structures ORDER BY structures.structure;
with column count = 3 and column width = 0 properties set in the corresponding search tab
Now, my problem is that if I set up a search criteria like the following
---------------------------------------------------------------------
If Not IsNull(Me.search_structure) Then
strWhere = strWhere & "([cod_structure] = " & Me.search_structure & ") AND "
End If
….some other code here ….
Me.Filter = strWhere
Me.FilterOn = True
----------------------------------------------------------------------
all is working fine because it is looking at the number field “id_structure” but then I get all mess up when I’m trying to set up a searching criteria looking to the correlated column “structure_acronym” which is supposed to be a text field
I’ve been trying by modifying the above code by
----------------------------------------------------------------------
If Not IsNull(Me.search_structure) Then
strWhere = strWhere & "([cod_structure.column(2)] = """ & Me.search_structure & """) AND "
End If
----------------------------------------------------------------------
but again it returns me an error (3126) because I’m not able to retrieve the data;
I suppose it has something to do with the similar thread already solved
https://www.accessforums.net/programming/storing-content-variable-9333.html
but I’m still not able to figure out what the problem is and a way to sort it out properly
thanks for any support