defining criterias from VB

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

My query name is “Salidasâ€, I have a column named “Tipo†in this column
exists tree kinds of entries “nota†“factura†and “S.Intâ€, I want to define 4
different criterias using VB: 1.â€nota†or “factura†2.â€Factura†3.â€Notaâ€
4.â€S.Int†these criterias are going to be linked to some buttons that I have
in a form, this buttons will open the query with some criteria (button 1
criteria 1, button 2 criteria 2…etc).
 
Try and use this code that open the query and change the sql, so you can rn
it with any criteria you woul like
on the after update of the field enter this code

Dim DBS As Database
Dim rst As Recordset, Criteria As String, SqlStr as string

Set DBS = CodeDb
Criteria = "'nota','factura'"
SqlStr = "SELECT * FROM MyTable WHERE Tipo in (" & Criteria & ")"
DBS.QueryDefs("Salidas").SQL = SqlStr

and now use the query.
 
Back
Top