Tema: Ka negerai darau ?
Autorius: b2b
Data: 2010-04-07 16:32:46
Ka negerai darau ? Ismeta klaidas (prisegti printscreen'ai):


Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address = "$B$1" Then

    With ActiveWorkbook.ActiveSheet.QueryTables(1)
        .BackgroundQuery = False
        .CommandText = Array( _
            "SELECT PM.PART_CODE [Produkto kodas], PM.PART_DESC_1 [Produkto 
pavadinimas]," & _
"PB.IC_LOT_NUMBER [Partija], PB.CREATION_DATE [Pagaminimo data], 
PM.SHELF_LIFE [Sandeliavimo trukme, d]," & _
"(PB.BEST_BEFORE_DATE-PM.DISTRIBUTION_DAYS) [Sand?liavimo data], 
PM.DISTRIBUTION_DAYS [Galiojimo trukme, d]," & _
"PB.BEST_BEFORE_DATE [Galioja iki], ILS.IC_QTY_AVAILABLE [Esamas 
(momentinis) kiekis], PM.IC_UNIT_CAPACITY [Mato vienetai]" & _
"FROM [duomenu_baze].[dbo].IC_LOT_STATUS ILS with (nolock, nowait)" & _
"INNER JOIN PRODUCT_MASTER PM  with (nolock, nowait)" & _
"ON PM.PART_CODE=ILS.PART_CODE and PM.IC_UNIT_CAPACITY=ILS.UNIT_OF_MEASURE" 
& _
"INNER JOIN PART_BATCHES PB with (nolock, nowait)" & _
"ON PB.PART_CODE=ILS.PART_CODE and PB.IC_LOT_NUMBER=ILS.IC_LOT_NUMBER and 
PB.WAREHOUSE=ILS.WAREHOUSE" & _
"and ILS.IC_QTY_AVAILABLE > '0.000000'" & _
"where ILS.WAREHOUSE  = 'ActiveWorkbook.ActiveSheet.Cells(1, 2).Value'" & _
"order by ILS.WAREHOUSE, PB.CREATION_DATE")
        .Refresh
    End With
    End If
End Sub