Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ComboList search help 1

Status
Not open for further replies.

DarkOne72

Technical User
Jun 14, 2002
210
US
Hello,
I am having a problem as to where I am trying to do a search with three different search criterias
Date Range, StockNum, ConsignorNum

When I select the drop downs and lets say I choose 4 for stockum it returns all records with 4 in it. (example: 4, 124, 144, 1244, 4123, etc)Is there a way to get the record of number 4 to show instead all the records?

My date criteria works fine it is just these two searches not doing what I want. I use the following in the query:
For stock num:

Like "*" & [Forms]![CSearch]![StockNum] & "*"
For Consignor num:

Like "*" & [Forms]![CSearch]![ConsignorNum] & "*"

and my date search (datein):

Between nz([Forms]![Csearch]![DateMin],#1/1/1980#) And nz([Forms]![Csearch]![DateMax],#1/1/2200#)

and also here is the sql code for the query:

SELECT tblStockList.ConsignorNum, tblStockList.StockNum, tblStockList.DateIn, tblStockList.InvType, tblStockList.Description, tblStockList.Size, tblStockList.AskingPrice, tblStockList.SoldDate, tblStockList.SoldPrice, tblStockList.PaidDate, tblStockList.Returned, tblStockList.RetDate, qryConsignorName.Name
FROM tblStockList INNER JOIN qryConsignorName ON tblStockList.ConsignorNum = qryConsignorName.ConsignorNum
GROUP BY tblStockList.ConsignorNum, tblStockList.StockNum, tblStockList.DateIn, tblStockList.InvType, tblStockList.Description, tblStockList.Size, tblStockList.AskingPrice, tblStockList.SoldDate, tblStockList.SoldPrice, tblStockList.PaidDate, tblStockList.Returned, tblStockList.RetDate, qryConsignorName.Name
HAVING (((tblStockList.ConsignorNum) Like "*" & [Forms]![CSearch]![ConsignorNum] & "*") AND ((tblStockList.StockNum) Like "*" & [Forms]![CSearch]![StockNum] & "*") AND ((tblStockList.DateIn) Between nz([Forms]![Csearch]![DateMin],#1/1/1980#) And nz([Forms]![Csearch]![DateMax],#1/1/2200#) Or (tblStockList.DateIn) Between nz([Forms]![Csearch]![DateMin],#1/1/1980#) And nz([Forms]![Csearch]![DateMax],#1/1/2200#))) OR (((tblStockList.ConsignorNum) Like "*" & [Forms]![CSearch]![ConsignorNum] & "*") AND ((tblStockList.StockNum) Like "*" & [Forms]![CSearch]![StockNum] & "*") AND ((tblStockList.DateIn) Between nz([Forms]![Csearch]![DateMin],#1/1/1980#) And nz([Forms]![Csearch]![DateMax],#1/1/2200#) Or (tblStockList.DateIn) Between nz([Forms]![Csearch]![DateMin],#1/1/1980#) And nz([Forms]![Csearch]![DateMax],#1/1/2200#)));

thank you
 
If you just want a specific StockNum and a specific ConsignorNum, then you don't need Like

For stock num:
--Change:
Like "*" & [Forms]![CSearch]![StockNum] & "*"
--To:
=[Forms]![CSearch]![StockNum]

For Consignor num:
--Change:
Like "*" & [Forms]![CSearch]![ConsignorNum] & "*"
--To:
=[Forms]![CSearch]![ConsignorNum]

I've not studied your SQL statement, only the specific problems that you mentioned.

Hope this helps.
 
Thank you, I was sorta on the right. I appreciate the qwuick response. Have a star!!

Dark...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top