Hi, I want to create a query criteria ("facturas" or " notas" in
"tipo" column)using VB, could you sendme the code and commands.
It depends a bit on what you want to do with the records afterwards.
If you want to open a form or a report, attach it to the Filter
parameter:
' create the criterion
strWhere = "Tipo=""facturas"" OR Tipo=""notas"")"
' open the form: I can't remember offhand how many commas to skip,
' check the help file first!
DoCmd.OpenForm strFormName,,strWhere
If you need a recordset to do something with, then you need the whole
command:
strSQL = "SELECT Something, SomethingElse " & _
"FROM MyTable " & _
"WHERE Tipo=""facturas"" OR Tipo=""notas"") " & _
"ORDER BY SomethingElse"
' and get the data
Set rs = db.OpenRecordset(strSQL, dbOpenSnapshot, dbForwardOnly)
' and do something
Do While Not rs.EOF
' etc etc
If you just want to see the things in a datasheet (boo, hiss!)
strSQL = "SELECT etc"
Set qdf = db.QueryDefs.Add(strTempQuery) '
qdf.SQL = strSQL
DoCmd.OpenQuerydef strTempQuery
and so on. Hope that helps
Tim F