Search a query from form

  • Thread starter Thread starter Simon
  • Start date Start date
S

Simon

I have a form that is based on a query that i use to seach for
products that we sell

i have 3 text boxs that are the following
barcode
Product code
Product Name

i type text in either of the above it it requerys the form

Like "*" & [forms]![frmProductList]![ProductCodeSearch] & "*" Or Is
Null

Is there a way i can have one field on the form but it will seach the
barcode, prodcutcode and product code

Thanks




SELECT tblProduct.Barcode, tblProduct.ProductID,
tblProduct.ProductCode, tblProduct.PriceIncVAT,
tblProduct.ProductName, qryStock.StockLevel, tblProduct.StockedItem,
tblProduct.Discontinued
FROM tblProduct INNER JOIN qryStock ON tblProduct.ProductID =
qryStock.ProductID
GROUP BY tblProduct.Barcode, tblProduct.ProductID,
tblProduct.ProductCode, tblProduct.PriceIncVAT,
tblProduct.ProductName, qryStock.StockLevel, tblProduct.StockedItem,
tblProduct.Discontinued
HAVING (((tblProduct.Barcode) Like "*" & [forms]![frmProductList]!
[BarCodeSearch] & "*" Or (tblProduct.Barcode) Is Null) AND
((tblProduct.ProductCode) Like "*" & [forms]![frmProductList]!
[ProductCodeSearch] & "*" Or (tblProduct.ProductCode) Is Null) AND
((tblProduct.ProductName) Like "*" & [forms]![frmProductList]!
[txtProductSearch] & "*" Or (tblProduct.ProductName) Is Null) AND
((tblProduct.Discontinued)=[forms]![frmProductList]![Dis]));
 
Put that same criterion under the other two fields, but make sure each
occurrence is on a different line in the grid.

If you put them on the same line in the grid, it will AND them together.
Putting them on separate lines ORs them together.
 
Back
Top