VBA Access - Error in product search engine

0

I am preparing a product search engine in a table. I want to know if there is a product unless it meets the given condition.

If in the input of the function I put a 'c' I would like to know if there is at least one record that contains a text string that has a character like that. For example: "house", "truck", "chest" ... etc ..

The code I have prepared is the following:

Private Function VerificaProducto(ByVal Codigo, ByVal Familia, ByVal Proveedor) As String

Dim Horno As Database
Dim Panes As Recordset

Set Horno = CurrentDb

If Proveedor = "Cuetara" Then
    Set Panes = Horno.OpenRecordset("almacenpanes", dbOpenDynaset)

    If Familia Like "Integral" Then 
        Panes.FindFirst "codigo = ' " & "*" & Codigo & "*" & " ' and activo = true and tipo = 'Hidratos' and familia LIKE '*'&'INTEGRAL'&'*'"
    Else
        Panes.FindFirst "codigo = ' " & "*" & Codigo & "*" & " ' and activo = true and tipo = 'Hidratos' and familia NOT LIKE '*'&'INTEGRAL'&'*'"
    End If
End If
If Panes.NoMatch Then

    Me!NombreProducto = "CODIGO NO PRESENTE EN LAS TABLAS"

    VerificaProducto = "producto no encontrado"
Else
    VerificaProducto = "producto encontrado"
End If
End Function

If a bread type Integral has been selected, the function will delimit the search to those results: Only the records of integral type. If not, only those who are not of the integral type.

Then, you should see if there is at least one code that has part of the code entered.

However, it seems that the argument variable code is taken literally and does not look for the strings that can be compatible with that code. Can anyone give any clue as to why?

    
asked by AccOUCH 05.11.2018 в 16:02
source

0 answers