|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Populating RS but ignoring certain records?
Hiya,
Is there a way to ignore certain records when populating a recordset? In this instance, a total is built up by moving through each record, but it will double up on some parts, which i need to get it to ignore. Each record has the fields FacetPartNo (the field i'm interested in) and LinkStock1, which tells us it's the same part as another FacetPartNo, and therefore needs to be ignored. Example: FacetPartNo = 12345, LinkStock1=null, Value=£100 FacetPartNo = 23456, LinkStock1=34567, value=£50 FacetPartNo = 34567, LinkStock1=null, value=£50 This shows that 23456 is the same as 34567 so when doing calculations i need it to ignore 34567. Can this be done? Current coding for the counting: Code:
objRS = objConn.Execute("SELECT FacetPartNo,Supplier1Price,RetailPrice,TradePrice, WholesalePrice,DistributorPrice,StockLevel FROM prices")
StockCount = 0
StockValueR = 0
StockValueT = 0
StockValueW = 0
StockValueD = 0
StockValueN = 0
While Not objRS.EOF
StockCount = cdec(StockCount) + cdec(objRS.Fields("StockLevel").value)
StockValueR = cdec(StockValueR) + (cdec(objRS.Fields("RetailPrice").value) * objRS.Fields("StockLevel").Value)
StockValueT = cdec(StockValueT) + (cdec(objRS.Fields("TradePrice").value) * objRS.Fields("StockLevel").Value)
StockValueW = cdec(StockValueW) + (cdec(objRS.Fields("WholesalePrice").value) * objRS.Fields("StockLevel").Value)
StockValueD = cdec(StockValueD) + (cdec(objRS.Fields("DistributorPrice").value) * objRS.Fields("StockLevel").Value)
StockValueN = cdec(StockValueN) + (cdec(objRS.Fields("Supplier1Price").Value) * objRS.Fields("StockLevel").Value)
objRS.movenext
End While
Thanks! Baz Last edited by bazzanoid : October 26th, 2009 at 10:17 AM. |
|
#2
|
||||
|
||||
|
Sorry, i really dont understand what you need here
![]() Do you want to ignore record if FacetPartNo = 34567 or LinkStock1=34567 or both = 34567 or something else?? |
|
#3
|
|||
|
|||
|
I want to ignore any records in the table where FacetPartNo is equal to a previous LinkStock1 - the purpose of LinkStock1 is to tell the system if a part number (FacetPartNo) is shared with another part, and therefore only count once. So if a particular part number is linked to two or three others, it will only count it once.
I was thinking if it's possible to build a list from the LinkStock1 field first then a select statement told to exclude any FacetPartNo records in the list, if you see what i mean! |
![]() |
| Viewing: ASP Free Forums > Programming > .NET Development > Populating RS but ignoring certain records? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|