Defining Query Criteria from VB

F

filo666

Hi, I have a query named "Salidas", I want a code in VB that opens that query
(docmd.openquery "Salidas") and define a criteria in the column "Tipo" (that
can be "facturas", "Notas" or "Sal. Int.").
Example:
Show just the "factura" or "nota"
TIA
 
K

Klatuu

Set dbs = CurrentDb
Set qdf = dbs.QueryDefs("Salidas")
qdf.Parameters(0) = "nota"
Set rst = qdf.OpenRecordset(dbOpenSnapshot, dbReadOnly)
rst.MoveLast
rst.MoveFirst
 
Top