Hi All
I need a report based on the criteria(number range)say: "BaleNo(USCNo.) 0302 to BaleNo(USCNo) 0306". The report should display all records between 0302 and 0306. I can't use "Between" criteria as datatype for BaleNo is Text. I used following Union query with parameters and in the where clause Like function with the following syntax(you can see in SQL). With this criteria my report is displaying only 0302 and 0306 records but not picking up in between records say 0303, 0304, 0305.I know something wrong with my syntax, I guess I have to use convert function(string to number) but I am not sure with the syntax. Could anyone suggest me the correct syntax so that all the records between 0302 to 0306 are displayed in my report.
PARAMETERS FORMS!Form1![USCNo1] Text, FORMS!Form1![USCNo2] Text, zz_RepPar.StockStatusId Text;
SELECT tblStock.StockID, tblStock.Description, tblStock.UnitOfMeasureID, tblPattern.BaleNo, tblPattern.Pattern, tblPattern.Dye, tblPattern.QuantityReceived, tblPattern.Quantity, tblPattern.JobID, tblPattern.SBN, tblPattern.Notation, tblPattern.LocationID, tblPattern.ActualCost, [Quantity]*[ActualCost] AS Total, tblPattern.USCCategoryID, tlkpStockStatus.StockStatusDescr, zz_RepPar.TransDate
FROM tblStock RIGHT JOIN ((zz_RepPar LEFT JOIN tlkpStockStatus ON zz_RepPar.StockStatusID = tlkpStockStatus.StockStatusID) LEFT JOIN tblPattern ON zz_RepPar.StockStatusID = tblPattern.StockStatusID) ON tblStock.StockID = tblPattern.StockID
WHERE tblPattern.BaleNo Like Left(FORMS!Form1![USCNo1],4)& "*" AND((tblPattern.Quantity)<>0)
UNION
SELECT tblStock.StockID, tblStock.Description, tblStock.UnitOfMeasureID, tblPattern.BaleNo, tblPattern.Pattern, tblPattern.Dye, tblPattern.QuantityReceived, tblPattern.Quantity, tblPattern.JobID, tblPattern.SBN, tblPattern.Notation, tblPattern.LocationID, tblPattern.ActualCost, [Quantity]*[ActualCost] AS Total, tblPattern.USCCategoryID, tlkpStockStatus.StockStatusDescr, zz_RepPar.TransDate
FROM tblStock RIGHT JOIN ((zz_RepPar LEFT JOIN tlkpStockStatus ON zz_RepPar.StockStatusID = tlkpStockStatus.StockStatusID) LEFT JOIN tblPattern ON zz_RepPar.StockStatusID = tblPattern.StockStatusID) ON tblStock.StockID = tblPattern.StockID
WHERE tblPattern.BaleNo Like Left(FORMS!Form1![USCNo2],4)& "*" AND((tblPattern.Quantity)<>0);
I need a report based on the criteria(number range)say: "BaleNo(USCNo.) 0302 to BaleNo(USCNo) 0306". The report should display all records between 0302 and 0306. I can't use "Between" criteria as datatype for BaleNo is Text. I used following Union query with parameters and in the where clause Like function with the following syntax(you can see in SQL). With this criteria my report is displaying only 0302 and 0306 records but not picking up in between records say 0303, 0304, 0305.I know something wrong with my syntax, I guess I have to use convert function(string to number) but I am not sure with the syntax. Could anyone suggest me the correct syntax so that all the records between 0302 to 0306 are displayed in my report.
PARAMETERS FORMS!Form1![USCNo1] Text, FORMS!Form1![USCNo2] Text, zz_RepPar.StockStatusId Text;
SELECT tblStock.StockID, tblStock.Description, tblStock.UnitOfMeasureID, tblPattern.BaleNo, tblPattern.Pattern, tblPattern.Dye, tblPattern.QuantityReceived, tblPattern.Quantity, tblPattern.JobID, tblPattern.SBN, tblPattern.Notation, tblPattern.LocationID, tblPattern.ActualCost, [Quantity]*[ActualCost] AS Total, tblPattern.USCCategoryID, tlkpStockStatus.StockStatusDescr, zz_RepPar.TransDate
FROM tblStock RIGHT JOIN ((zz_RepPar LEFT JOIN tlkpStockStatus ON zz_RepPar.StockStatusID = tlkpStockStatus.StockStatusID) LEFT JOIN tblPattern ON zz_RepPar.StockStatusID = tblPattern.StockStatusID) ON tblStock.StockID = tblPattern.StockID
WHERE tblPattern.BaleNo Like Left(FORMS!Form1![USCNo1],4)& "*" AND((tblPattern.Quantity)<>0)
UNION
SELECT tblStock.StockID, tblStock.Description, tblStock.UnitOfMeasureID, tblPattern.BaleNo, tblPattern.Pattern, tblPattern.Dye, tblPattern.QuantityReceived, tblPattern.Quantity, tblPattern.JobID, tblPattern.SBN, tblPattern.Notation, tblPattern.LocationID, tblPattern.ActualCost, [Quantity]*[ActualCost] AS Total, tblPattern.USCCategoryID, tlkpStockStatus.StockStatusDescr, zz_RepPar.TransDate
FROM tblStock RIGHT JOIN ((zz_RepPar LEFT JOIN tlkpStockStatus ON zz_RepPar.StockStatusID = tlkpStockStatus.StockStatusID) LEFT JOIN tblPattern ON zz_RepPar.StockStatusID = tblPattern.StockStatusID) ON tblStock.StockID = tblPattern.StockID
WHERE tblPattern.BaleNo Like Left(FORMS!Form1![USCNo2],4)& "*" AND((tblPattern.Quantity)<>0);