Hello again

Please your support with the next statement in vb.net and access database
this is part of the code can you help me
the error code is missing operator in query expression

            str = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\\MXDTBTZ3XC1\Users\MXDTBTZ3XC1\Desktop\refacciones web\surtido.accdb"
            con = New OleDbConnection(str)
            sql = "select * from material where IDDOS ='" & TextBox10.Text & "' AND MATERIAL ACEPTABLE = '" & TextBox14.Text & "'"

It's never a good idea to use spaces in field names. If you do then you have to use delimiters around the field name. If possible you should rename the field and code something like

sql = "select * from material where IDDOS ='" & TextBox10.Text & "' AND MATERIAL_ACEPTABLE = '" & TextBox14.Text & "'"

Access may be the same as MS-SQL in which case you could code

sql = "select * from material where IDDOS ='" & TextBox10.Text & "' AND [MATERIAL ACEPTABLE] = '" & TextBox14.Text & "'"

If that doesn't work you'll have to look up the correct delmiter for Access.

Hello Reverend Jim

the operator "AND" throws me an error please check my code I´ve made a modification
in my database
"Conversion from string to type Long is not valid"
I believe my statement is not the right one for achieve what i want

again
I share the part of code that have the issue

        str = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\\MXDTBTZ3XC1\Users\MXDTBTZ3XC1\Desktop\refacciones web\inventarioreal.accdb"
        con = New OleDbConnection(str)
        sql = "select * from inventario where numero_de_parte ='" & TextBox2.Text & "'" And "MATERIAL_ACEPTABLE = '" & TextBox14.Text & "'"

Hello it´s resovled

it was just an apostrophe damn!!!!

I hate when this kind of things happen, something that is just that easy and dificult to see
thanks Reverend Jim

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.