slow SQL connection - only when using macro

robo0502

New Member
Joined
Feb 28, 2016
Messages
9
Hi guys,

I have a SQL connection created in Excel - second code below. I use fixed cells as parameters for this. When I run this connection manually it is relatively fast. However when I use VBA (first code below) to run it, it is extremnly slow or stuck. Could you pls advise if you know the reason for it and how to fix it?

Thank you

Code:
Sheets("Frontsheet SNs").Select
    ActiveSheet.Unprotect
    Range("Table_Query_from_DM_EMEA_IT[[#Headers],[COUNTRY]]").Select


    Selection.ListObject.QueryTable.Refresh BackgroundQuery:=False


Code:
SELECT DISTINCT ZOH_BLS08_IDL.COUNTRY, 
ZOH_BLS08_IDL.DOC_NUMBER AS 'SAP Order No', 
ZOH_BLS08_IDL.GT_BSTKD AS 'PO', 
ZOH_BLS08_IDL.MATERIAL AS 'PN', 
ZOH_SDS46_IDL.SERNO AS 'SN', 
ZOH_MDS32_IDL.ZSUBSER_D AS 'PN Description', 
ZOH_BLS08_IDL.DOC_TYPE AS 'Order Type', 
ZOH_BLS08_IDL.NETVAL_INV AS 'Net Item Line Value', 
ZOH_BLS08_IDL.INV_QTY AS 'Item Qty', 
ZOH_BLS08_IDL.TAX_AMOUNT AS 'VAT', 
ZOH_BLS08_IDL.DOC_CURRCY AS 'Currency', 
ZOH_MDS32_IDL.LENGHT AS 'Lenght', 
ZOH_MDS32_IDL.WIDTH AS 'Width', 
ZOH_MDS32_IDL.HEIGHT AS 'Height', 
ZOH_MDS32_IDL.UNIT_DIM AS 'Unit Dim', 
ZOH_MDS32_IDL.GROSS_WT AS 'Gross WT', 
ZOH_MDS32_IDL.UNIT_OF_WT AS 'Unit of GW', 
ZOH_BLS08_IDL.REFER_DOC AS 'Delivery No', 
ZOH_BLS08_IDL.BILL_NUM AS 'Invoice No', 
convert(varchar(8),ZOH_BLS08_IDL.BILL_DATE,112) AS 'Invoice Date', 
cast(ZOH_BLS08_IDL.SOLD_TO as int) AS 'Sold to ID', 
ZOH_BLS08_IDL.BILLTOPRTY AS 'Bill to ID', 
ZOH_BLS08_IDL.SHIP_TO, ZOH_BLS08_IDL.SHIP_POINT AS 'Shipping point', 
ZOH_BLS08_IDL.SALES_OFF AS 'Sales Office', 
ZOH_BLS08_IDL.ZBPNAME AS 'Customer name', 
ZOH_BLS08_IDL.BP_TYPE AS 'Customer Type', 
ZOH_BLS08_IDL.ZEND_CUST AS 'End Customer ID', 
ZOH_BLS08_IDL.ZVATRATE AS 'VAT Rate', 
ZOH_BLS08_IDL.BBP_CTC_ID AS 'Contract No', 
ZOH_SDS46_IDL.SHIPPTYP AS 'Shipping Type', 
ZOH_BLS08_IDL.BILL_TYPE AS 'Billing Type', 
ZOH_BLS08_IDL.PAYER AS 'Payer ID', 
ZOH_BLS08_IDL.DIVISION AS 'Division', 
ZOH_BLS08_IDL.VAT_REG_NO AS 'VAT ID', 
ZOH_BLS08_IDL.SALESORG AS 'Sales Org', 
ZOH_BLS08_IDL.DISTR_CHAN AS 'Distr Channel', 
ZOH_BLS08_IDL.ZTERM AS 'Payment Term Code', 
ZOH_MDS32_IDL.SIZE_DIM, 
ZOH_MDS32_IDL.NET_WEIGHT, 
ZOH_MDS32_IDL.ZSYSOPT


FROM DM_EMEA_IT.dbo.ZOH_BLS08_IDL ZOH_BLS08_IDL, DM_EMEA_IT.dbo.ZOH_MDS32_IDL ZOH_MDS32_IDL, DM_EMEA_IT.dbo.ZOH_SDS46_IDL ZOH_SDS46_IDL


WHERE ZOH_BLS08_IDL.MATERIAL = ZOH_SDS46_IDL.ZMAT AND ZOH_BLS08_IDL.REFER_DOC = ZOH_SDS46_IDL.DELIV_NUMB AND ZOH_BLS08_IDL.MATERIAL = ZOH_MDS32_IDL.ZMAT AND 
(
(ZOH_BLS08_IDL.GT_BSTKD Like ?) AND (ZOH_BLS08_IDL.MATERIAL Like ?) AND (ZOH_SDS46_IDL.SERNO Like ?) AND (ZOH_BLS08_IDL.BILL_TYPE In ('YBF2','YBG2','YBL2','YBRE','YBFG')) AND (ZOH_BLS08_IDL.SOLD_TO Like '1%') AND (ZOH_BLS08_IDL.AB_FKSTO<>'x') AND (ZOH_SDS46_IDL.ZACT_DAT Is Not Null) 


OR (ZOH_BLS08_IDL.GT_BSTKD Like ?) AND (ZOH_BLS08_IDL.MATERIAL Like ?) AND (ZOH_SDS46_IDL.SERNO Like ?) AND (ZOH_BLS08_IDL.BILL_TYPE In ('YBF2','YBG2','YBL2','YBRE','YBFG')) AND (ZOH_BLS08_IDL.SOLD_TO Like '1%') AND (ZOH_BLS08_IDL.AB_FKSTO<>'x') AND (ZOH_SDS46_IDL.ZACT_DAT Is Not Null)
OR (ZOH_BLS08_IDL.GT_BSTKD Like ?) AND (ZOH_BLS08_IDL.MATERIAL Like ?) AND (ZOH_SDS46_IDL.SERNO Like ?) AND (ZOH_BLS08_IDL.BILL_TYPE In ('YBF2','YBG2','YBL2','YBRE','YBFG')) AND (ZOH_BLS08_IDL.SOLD_TO Like '1%') AND (ZOH_BLS08_IDL.AB_FKSTO<>'x') AND (ZOH_SDS46_IDL.ZACT_DAT Is Not Null)
OR (ZOH_BLS08_IDL.GT_BSTKD Like ?) AND (ZOH_BLS08_IDL.MATERIAL Like ?) AND (ZOH_SDS46_IDL.SERNO Like ?) AND (ZOH_BLS08_IDL.BILL_TYPE In ('YBF2','YBG2','YBL2','YBRE','YBFG')) AND (ZOH_BLS08_IDL.SOLD_TO Like '1%') AND (ZOH_BLS08_IDL.AB_FKSTO<>'x') AND (ZOH_SDS46_IDL.ZACT_DAT Is Not Null)
OR (ZOH_BLS08_IDL.GT_BSTKD Like ?) AND (ZOH_BLS08_IDL.MATERIAL Like ?) AND (ZOH_SDS46_IDL.SERNO Like ?) AND (ZOH_BLS08_IDL.BILL_TYPE In ('YBF2','YBG2','YBL2','YBRE','YBFG')) AND (ZOH_BLS08_IDL.SOLD_TO Like '1%') AND (ZOH_BLS08_IDL.AB_FKSTO<>'x') AND (ZOH_SDS46_IDL.ZACT_DAT Is Not Null)
OR (ZOH_BLS08_IDL.GT_BSTKD Like ?) AND (ZOH_BLS08_IDL.MATERIAL Like ?) AND (ZOH_SDS46_IDL.SERNO Like ?) AND (ZOH_BLS08_IDL.BILL_TYPE In ('YBF2','YBG2','YBL2','YBRE','YBFG')) AND (ZOH_BLS08_IDL.SOLD_TO Like '1%') AND (ZOH_BLS08_IDL.AB_FKSTO<>'x') AND (ZOH_SDS46_IDL.ZACT_DAT Is Not Null)
OR (ZOH_BLS08_IDL.GT_BSTKD Like ?) AND (ZOH_BLS08_IDL.MATERIAL Like ?) AND (ZOH_SDS46_IDL.SERNO Like ?) AND (ZOH_BLS08_IDL.BILL_TYPE In ('YBF2','YBG2','YBL2','YBRE','YBFG')) AND (ZOH_BLS08_IDL.SOLD_TO Like '1%') AND (ZOH_BLS08_IDL.AB_FKSTO<>'x') AND (ZOH_SDS46_IDL.ZACT_DAT Is Not Null)
OR (ZOH_BLS08_IDL.GT_BSTKD Like ?) AND (ZOH_BLS08_IDL.MATERIAL Like ?) AND (ZOH_SDS46_IDL.SERNO Like ?) AND (ZOH_BLS08_IDL.BILL_TYPE In ('YBF2','YBG2','YBL2','YBRE','YBFG')) AND (ZOH_BLS08_IDL.SOLD_TO Like '1%') AND (ZOH_BLS08_IDL.AB_FKSTO<>'x') AND (ZOH_SDS46_IDL.ZACT_DAT Is Not Null)
OR (ZOH_BLS08_IDL.GT_BSTKD Like ?) AND (ZOH_BLS08_IDL.MATERIAL Like ?) AND (ZOH_SDS46_IDL.SERNO Like ?) AND (ZOH_BLS08_IDL.BILL_TYPE In ('YBF2','YBG2','YBL2','YBRE','YBFG')) AND (ZOH_BLS08_IDL.SOLD_TO Like '1%') AND (ZOH_BLS08_IDL.AB_FKSTO<>'x') AND (ZOH_SDS46_IDL.ZACT_DAT Is Not Null)
OR (ZOH_BLS08_IDL.GT_BSTKD Like ?) AND (ZOH_BLS08_IDL.MATERIAL Like ?) AND (ZOH_SDS46_IDL.SERNO Like ?) AND (ZOH_BLS08_IDL.BILL_TYPE In ('YBF2','YBG2','YBL2','YBRE','YBFG')) AND (ZOH_BLS08_IDL.SOLD_TO Like '1%') AND (ZOH_BLS08_IDL.AB_FKSTO<>'x') AND (ZOH_SDS46_IDL.ZACT_DAT Is Not Null)


OR (ZOH_BLS08_IDL.GT_BSTKD Like ?) AND (ZOH_BLS08_IDL.MATERIAL Like ?) AND (ZOH_SDS46_IDL.SERNO Like ?) AND (ZOH_BLS08_IDL.BILL_TYPE In ('YBF2','YBG2','YBL2','YBRE','YBFG')) AND (ZOH_BLS08_IDL.SOLD_TO Like '1%') AND (ZOH_BLS08_IDL.AB_FKSTO<>'x') AND (ZOH_SDS46_IDL.ZACT_DAT Is Not Null)
OR (ZOH_BLS08_IDL.GT_BSTKD Like ?) AND (ZOH_BLS08_IDL.MATERIAL Like ?) AND (ZOH_SDS46_IDL.SERNO Like ?) AND (ZOH_BLS08_IDL.BILL_TYPE In ('YBF2','YBG2','YBL2','YBRE','YBFG')) AND (ZOH_BLS08_IDL.SOLD_TO Like '1%') AND (ZOH_BLS08_IDL.AB_FKSTO<>'x') AND (ZOH_SDS46_IDL.ZACT_DAT Is Not Null)
OR (ZOH_BLS08_IDL.GT_BSTKD Like ?) AND (ZOH_BLS08_IDL.MATERIAL Like ?) AND (ZOH_SDS46_IDL.SERNO Like ?) AND (ZOH_BLS08_IDL.BILL_TYPE In ('YBF2','YBG2','YBL2','YBRE','YBFG')) AND (ZOH_BLS08_IDL.SOLD_TO Like '1%') AND (ZOH_BLS08_IDL.AB_FKSTO<>'x') AND (ZOH_SDS46_IDL.ZACT_DAT Is Not Null)
OR (ZOH_BLS08_IDL.GT_BSTKD Like ?) AND (ZOH_BLS08_IDL.MATERIAL Like ?) AND (ZOH_SDS46_IDL.SERNO Like ?) AND (ZOH_BLS08_IDL.BILL_TYPE In ('YBF2','YBG2','YBL2','YBRE','YBFG')) AND (ZOH_BLS08_IDL.SOLD_TO Like '1%') AND (ZOH_BLS08_IDL.AB_FKSTO<>'x') AND (ZOH_SDS46_IDL.ZACT_DAT Is Not Null)
OR (ZOH_BLS08_IDL.GT_BSTKD Like ?) AND (ZOH_BLS08_IDL.MATERIAL Like ?) AND (ZOH_SDS46_IDL.SERNO Like ?) AND (ZOH_BLS08_IDL.BILL_TYPE In ('YBF2','YBG2','YBL2','YBRE','YBFG')) AND (ZOH_BLS08_IDL.SOLD_TO Like '1%') AND (ZOH_BLS08_IDL.AB_FKSTO<>'x') AND (ZOH_SDS46_IDL.ZACT_DAT Is Not Null)
OR (ZOH_BLS08_IDL.GT_BSTKD Like ?) AND (ZOH_BLS08_IDL.MATERIAL Like ?) AND (ZOH_SDS46_IDL.SERNO Like ?) AND (ZOH_BLS08_IDL.BILL_TYPE In ('YBF2','YBG2','YBL2','YBRE','YBFG')) AND (ZOH_BLS08_IDL.SOLD_TO Like '1%') AND (ZOH_BLS08_IDL.AB_FKSTO<>'x') AND (ZOH_SDS46_IDL.ZACT_DAT Is Not Null)
OR (ZOH_BLS08_IDL.GT_BSTKD Like ?) AND (ZOH_BLS08_IDL.MATERIAL Like ?) AND (ZOH_SDS46_IDL.SERNO Like ?) AND (ZOH_BLS08_IDL.BILL_TYPE In ('YBF2','YBG2','YBL2','YBRE','YBFG')) AND (ZOH_BLS08_IDL.SOLD_TO Like '1%') AND (ZOH_BLS08_IDL.AB_FKSTO<>'x') AND (ZOH_SDS46_IDL.ZACT_DAT Is Not Null)
OR (ZOH_BLS08_IDL.GT_BSTKD Like ?) AND (ZOH_BLS08_IDL.MATERIAL Like ?) AND (ZOH_SDS46_IDL.SERNO Like ?) AND (ZOH_BLS08_IDL.BILL_TYPE In ('YBF2','YBG2','YBL2','YBRE','YBFG')) AND (ZOH_BLS08_IDL.SOLD_TO Like '1%') AND (ZOH_BLS08_IDL.AB_FKSTO<>'x') AND (ZOH_SDS46_IDL.ZACT_DAT Is Not Null)
OR (ZOH_BLS08_IDL.GT_BSTKD Like ?) AND (ZOH_BLS08_IDL.MATERIAL Like ?) AND (ZOH_SDS46_IDL.SERNO Like ?) AND (ZOH_BLS08_IDL.BILL_TYPE In ('YBF2','YBG2','YBL2','YBRE','YBFG')) AND (ZOH_BLS08_IDL.SOLD_TO Like '1%') AND (ZOH_BLS08_IDL.AB_FKSTO<>'x') AND (ZOH_SDS46_IDL.ZACT_DAT Is Not Null)
OR (ZOH_BLS08_IDL.GT_BSTKD Like ?) AND (ZOH_BLS08_IDL.MATERIAL Like ?) AND (ZOH_SDS46_IDL.SERNO Like ?) AND (ZOH_BLS08_IDL.BILL_TYPE In ('YBF2','YBG2','YBL2','YBRE','YBFG')) AND (ZOH_BLS08_IDL.SOLD_TO Like '1%') AND (ZOH_BLS08_IDL.AB_FKSTO<>'x') AND (ZOH_SDS46_IDL.ZACT_DAT Is Not Null)


OR (ZOH_BLS08_IDL.GT_BSTKD Like ?) AND (ZOH_BLS08_IDL.MATERIAL Like ?) AND (ZOH_SDS46_IDL.SERNO Like ?) AND (ZOH_BLS08_IDL.BILL_TYPE In ('YBF2','YBG2','YBL2','YBRE','YBFG')) AND (ZOH_BLS08_IDL.SOLD_TO Like '1%') AND (ZOH_BLS08_IDL.AB_FKSTO<>'x') AND (ZOH_SDS46_IDL.ZACT_DAT Is Not Null)
OR (ZOH_BLS08_IDL.GT_BSTKD Like ?) AND (ZOH_BLS08_IDL.MATERIAL Like ?) AND (ZOH_SDS46_IDL.SERNO Like ?) AND (ZOH_BLS08_IDL.BILL_TYPE In ('YBF2','YBG2','YBL2','YBRE','YBFG')) AND (ZOH_BLS08_IDL.SOLD_TO Like '1%') AND (ZOH_BLS08_IDL.AB_FKSTO<>'x') AND (ZOH_SDS46_IDL.ZACT_DAT Is Not Null)
OR (ZOH_BLS08_IDL.GT_BSTKD Like ?) AND (ZOH_BLS08_IDL.MATERIAL Like ?) AND (ZOH_SDS46_IDL.SERNO Like ?) AND (ZOH_BLS08_IDL.BILL_TYPE In ('YBF2','YBG2','YBL2','YBRE','YBFG')) AND (ZOH_BLS08_IDL.SOLD_TO Like '1%') AND (ZOH_BLS08_IDL.AB_FKSTO<>'x') AND (ZOH_SDS46_IDL.ZACT_DAT Is Not Null)
OR (ZOH_BLS08_IDL.GT_BSTKD Like ?) AND (ZOH_BLS08_IDL.MATERIAL Like ?) AND (ZOH_SDS46_IDL.SERNO Like ?) AND (ZOH_BLS08_IDL.BILL_TYPE In ('YBF2','YBG2','YBL2','YBRE','YBFG')) AND (ZOH_BLS08_IDL.SOLD_TO Like '1%') AND (ZOH_BLS08_IDL.AB_FKSTO<>'x') AND (ZOH_SDS46_IDL.ZACT_DAT Is Not Null)
OR (ZOH_BLS08_IDL.GT_BSTKD Like ?) AND (ZOH_BLS08_IDL.MATERIAL Like ?) AND (ZOH_SDS46_IDL.SERNO Like ?) AND (ZOH_BLS08_IDL.BILL_TYPE In ('YBF2','YBG2','YBL2','YBRE','YBFG')) AND (ZOH_BLS08_IDL.SOLD_TO Like '1%') AND (ZOH_BLS08_IDL.AB_FKSTO<>'x') AND (ZOH_SDS46_IDL.ZACT_DAT Is Not Null)
OR (ZOH_BLS08_IDL.GT_BSTKD Like ?) AND (ZOH_BLS08_IDL.MATERIAL Like ?) AND (ZOH_SDS46_IDL.SERNO Like ?) AND (ZOH_BLS08_IDL.BILL_TYPE In ('YBF2','YBG2','YBL2','YBRE','YBFG')) AND (ZOH_BLS08_IDL.SOLD_TO Like '1%') AND (ZOH_BLS08_IDL.AB_FKSTO<>'x') AND (ZOH_SDS46_IDL.ZACT_DAT Is Not Null)
OR (ZOH_BLS08_IDL.GT_BSTKD Like ?) AND (ZOH_BLS08_IDL.MATERIAL Like ?) AND (ZOH_SDS46_IDL.SERNO Like ?) AND (ZOH_BLS08_IDL.BILL_TYPE In ('YBF2','YBG2','YBL2','YBRE','YBFG')) AND (ZOH_BLS08_IDL.SOLD_TO Like '1%') AND (ZOH_BLS08_IDL.AB_FKSTO<>'x') AND (ZOH_SDS46_IDL.ZACT_DAT Is Not Null)
OR (ZOH_BLS08_IDL.GT_BSTKD Like ?) AND (ZOH_BLS08_IDL.MATERIAL Like ?) AND (ZOH_SDS46_IDL.SERNO Like ?) AND (ZOH_BLS08_IDL.BILL_TYPE In ('YBF2','YBG2','YBL2','YBRE','YBFG')) AND (ZOH_BLS08_IDL.SOLD_TO Like '1%') AND (ZOH_BLS08_IDL.AB_FKSTO<>'x') AND (ZOH_SDS46_IDL.ZACT_DAT Is Not Null)
OR (ZOH_BLS08_IDL.GT_BSTKD Like ?) AND (ZOH_BLS08_IDL.MATERIAL Like ?) AND (ZOH_SDS46_IDL.SERNO Like ?) AND (ZOH_BLS08_IDL.BILL_TYPE In ('YBF2','YBG2','YBL2','YBRE','YBFG')) AND (ZOH_BLS08_IDL.SOLD_TO Like '1%') AND (ZOH_BLS08_IDL.AB_FKSTO<>'x') AND (ZOH_SDS46_IDL.ZACT_DAT Is Not Null)
OR (ZOH_BLS08_IDL.GT_BSTKD Like ?) AND (ZOH_BLS08_IDL.MATERIAL Like ?) AND (ZOH_SDS46_IDL.SERNO Like ?) AND (ZOH_BLS08_IDL.BILL_TYPE In ('YBF2','YBG2','YBL2','YBRE','YBFG')) AND (ZOH_BLS08_IDL.SOLD_TO Like '1%') AND (ZOH_BLS08_IDL.AB_FKSTO<>'x') AND (ZOH_SDS46_IDL.ZACT_DAT Is Not Null)


OR (ZOH_BLS08_IDL.GT_BSTKD Like ?) AND (ZOH_BLS08_IDL.MATERIAL Like ?) AND (ZOH_SDS46_IDL.SERNO Like ?) AND (ZOH_BLS08_IDL.BILL_TYPE In ('YBF2','YBG2','YBL2','YBRE','YBFG')) AND (ZOH_BLS08_IDL.SOLD_TO Like '1%') AND (ZOH_BLS08_IDL.AB_FKSTO<>'x') AND (ZOH_SDS46_IDL.ZACT_DAT Is Not Null)
OR (ZOH_BLS08_IDL.GT_BSTKD Like ?) AND (ZOH_BLS08_IDL.MATERIAL Like ?) AND (ZOH_SDS46_IDL.SERNO Like ?) AND (ZOH_BLS08_IDL.BILL_TYPE In ('YBF2','YBG2','YBL2','YBRE','YBFG')) AND (ZOH_BLS08_IDL.SOLD_TO Like '1%') AND (ZOH_BLS08_IDL.AB_FKSTO<>'x') AND (ZOH_SDS46_IDL.ZACT_DAT Is Not Null)
OR (ZOH_BLS08_IDL.GT_BSTKD Like ?) AND (ZOH_BLS08_IDL.MATERIAL Like ?) AND (ZOH_SDS46_IDL.SERNO Like ?) AND (ZOH_BLS08_IDL.BILL_TYPE In ('YBF2','YBG2','YBL2','YBRE','YBFG')) AND (ZOH_BLS08_IDL.SOLD_TO Like '1%') AND (ZOH_BLS08_IDL.AB_FKSTO<>'x') AND (ZOH_SDS46_IDL.ZACT_DAT Is Not Null)
OR (ZOH_BLS08_IDL.GT_BSTKD Like ?) AND (ZOH_BLS08_IDL.MATERIAL Like ?) AND (ZOH_SDS46_IDL.SERNO Like ?) AND (ZOH_BLS08_IDL.BILL_TYPE In ('YBF2','YBG2','YBL2','YBRE','YBFG')) AND (ZOH_BLS08_IDL.SOLD_TO Like '1%') AND (ZOH_BLS08_IDL.AB_FKSTO<>'x') AND (ZOH_SDS46_IDL.ZACT_DAT Is Not Null)
OR (ZOH_BLS08_IDL.GT_BSTKD Like ?) AND (ZOH_BLS08_IDL.MATERIAL Like ?) AND (ZOH_SDS46_IDL.SERNO Like ?) AND (ZOH_BLS08_IDL.BILL_TYPE In ('YBF2','YBG2','YBL2','YBRE','YBFG')) AND (ZOH_BLS08_IDL.SOLD_TO Like '1%') AND (ZOH_BLS08_IDL.AB_FKSTO<>'x') AND (ZOH_SDS46_IDL.ZACT_DAT Is Not Null)
OR (ZOH_BLS08_IDL.GT_BSTKD Like ?) AND (ZOH_BLS08_IDL.MATERIAL Like ?) AND (ZOH_SDS46_IDL.SERNO Like ?) AND (ZOH_BLS08_IDL.BILL_TYPE In ('YBF2','YBG2','YBL2','YBRE','YBFG')) AND (ZOH_BLS08_IDL.SOLD_TO Like '1%') AND (ZOH_BLS08_IDL.AB_FKSTO<>'x') AND (ZOH_SDS46_IDL.ZACT_DAT Is Not Null)
OR (ZOH_BLS08_IDL.GT_BSTKD Like ?) AND (ZOH_BLS08_IDL.MATERIAL Like ?) AND (ZOH_SDS46_IDL.SERNO Like ?) AND (ZOH_BLS08_IDL.BILL_TYPE In ('YBF2','YBG2','YBL2','YBRE','YBFG')) AND (ZOH_BLS08_IDL.SOLD_TO Like '1%') AND (ZOH_BLS08_IDL.AB_FKSTO<>'x') AND (ZOH_SDS46_IDL.ZACT_DAT Is Not Null)
OR (ZOH_BLS08_IDL.GT_BSTKD Like ?) AND (ZOH_BLS08_IDL.MATERIAL Like ?) AND (ZOH_SDS46_IDL.SERNO Like ?) AND (ZOH_BLS08_IDL.BILL_TYPE In ('YBF2','YBG2','YBL2','YBRE','YBFG')) AND (ZOH_BLS08_IDL.SOLD_TO Like '1%') AND (ZOH_BLS08_IDL.AB_FKSTO<>'x') AND (ZOH_SDS46_IDL.ZACT_DAT Is Not Null)
OR (ZOH_BLS08_IDL.GT_BSTKD Like ?) AND (ZOH_BLS08_IDL.MATERIAL Like ?) AND (ZOH_SDS46_IDL.SERNO Like ?) AND (ZOH_BLS08_IDL.BILL_TYPE In ('YBF2','YBG2','YBL2','YBRE','YBFG')) AND (ZOH_BLS08_IDL.SOLD_TO Like '1%') AND (ZOH_BLS08_IDL.AB_FKSTO<>'x') AND (ZOH_SDS46_IDL.ZACT_DAT Is Not Null)
OR (ZOH_BLS08_IDL.GT_BSTKD Like ?) AND (ZOH_BLS08_IDL.MATERIAL Like ?) AND (ZOH_SDS46_IDL.SERNO Like ?) AND (ZOH_BLS08_IDL.BILL_TYPE In ('YBF2','YBG2','YBL2','YBRE','YBFG')) AND (ZOH_BLS08_IDL.SOLD_TO Like '1%') AND (ZOH_BLS08_IDL.AB_FKSTO<>'x') AND (ZOH_SDS46_IDL.ZACT_DAT Is Not Null)


OR (ZOH_BLS08_IDL.GT_BSTKD Like ?) AND (ZOH_BLS08_IDL.MATERIAL Like ?) AND (ZOH_SDS46_IDL.SERNO Like ?) AND (ZOH_BLS08_IDL.BILL_TYPE In ('YBF2','YBG2','YBL2','YBRE','YBFG')) AND (ZOH_BLS08_IDL.SOLD_TO Like '1%') AND (ZOH_BLS08_IDL.AB_FKSTO<>'x') AND (ZOH_SDS46_IDL.ZACT_DAT Is Not Null)
OR (ZOH_BLS08_IDL.GT_BSTKD Like ?) AND (ZOH_BLS08_IDL.MATERIAL Like ?) AND (ZOH_SDS46_IDL.SERNO Like ?) AND (ZOH_BLS08_IDL.BILL_TYPE In ('YBF2','YBG2','YBL2','YBRE','YBFG')) AND (ZOH_BLS08_IDL.SOLD_TO Like '1%') AND (ZOH_BLS08_IDL.AB_FKSTO<>'x') AND (ZOH_SDS46_IDL.ZACT_DAT Is Not Null)
OR (ZOH_BLS08_IDL.GT_BSTKD Like ?) AND (ZOH_BLS08_IDL.MATERIAL Like ?) AND (ZOH_SDS46_IDL.SERNO Like ?) AND (ZOH_BLS08_IDL.BILL_TYPE In ('YBF2','YBG2','YBL2','YBRE','YBFG')) AND (ZOH_BLS08_IDL.SOLD_TO Like '1%') AND (ZOH_BLS08_IDL.AB_FKSTO<>'x') AND (ZOH_SDS46_IDL.ZACT_DAT Is Not Null)
OR (ZOH_BLS08_IDL.GT_BSTKD Like ?) AND (ZOH_BLS08_IDL.MATERIAL Like ?) AND (ZOH_SDS46_IDL.SERNO Like ?) AND (ZOH_BLS08_IDL.BILL_TYPE In ('YBF2','YBG2','YBL2','YBRE','YBFG')) AND (ZOH_BLS08_IDL.SOLD_TO Like '1%') AND (ZOH_BLS08_IDL.AB_FKSTO<>'x') AND (ZOH_SDS46_IDL.ZACT_DAT Is Not Null)
OR (ZOH_BLS08_IDL.GT_BSTKD Like ?) AND (ZOH_BLS08_IDL.MATERIAL Like ?) AND (ZOH_SDS46_IDL.SERNO Like ?) AND (ZOH_BLS08_IDL.BILL_TYPE In ('YBF2','YBG2','YBL2','YBRE','YBFG')) AND (ZOH_BLS08_IDL.SOLD_TO Like '1%') AND (ZOH_BLS08_IDL.AB_FKSTO<>'x') AND (ZOH_SDS46_IDL.ZACT_DAT Is Not Null)
OR (ZOH_BLS08_IDL.GT_BSTKD Like ?) AND (ZOH_BLS08_IDL.MATERIAL Like ?) AND (ZOH_SDS46_IDL.SERNO Like ?) AND (ZOH_BLS08_IDL.BILL_TYPE In ('YBF2','YBG2','YBL2','YBRE','YBFG')) AND (ZOH_BLS08_IDL.SOLD_TO Like '1%') AND (ZOH_BLS08_IDL.AB_FKSTO<>'x') AND (ZOH_SDS46_IDL.ZACT_DAT Is Not Null)
OR (ZOH_BLS08_IDL.GT_BSTKD Like ?) AND (ZOH_BLS08_IDL.MATERIAL Like ?) AND (ZOH_SDS46_IDL.SERNO Like ?) AND (ZOH_BLS08_IDL.BILL_TYPE In ('YBF2','YBG2','YBL2','YBRE','YBFG')) AND (ZOH_BLS08_IDL.SOLD_TO Like '1%') AND (ZOH_BLS08_IDL.AB_FKSTO<>'x') AND (ZOH_SDS46_IDL.ZACT_DAT Is Not Null)
OR (ZOH_BLS08_IDL.GT_BSTKD Like ?) AND (ZOH_BLS08_IDL.MATERIAL Like ?) AND (ZOH_SDS46_IDL.SERNO Like ?) AND (ZOH_BLS08_IDL.BILL_TYPE In ('YBF2','YBG2','YBL2','YBRE','YBFG')) AND (ZOH_BLS08_IDL.SOLD_TO Like '1%') AND (ZOH_BLS08_IDL.AB_FKSTO<>'x') AND (ZOH_SDS46_IDL.ZACT_DAT Is Not Null)
OR (ZOH_BLS08_IDL.GT_BSTKD Like ?) AND (ZOH_BLS08_IDL.MATERIAL Like ?) AND (ZOH_SDS46_IDL.SERNO Like ?) AND (ZOH_BLS08_IDL.BILL_TYPE In ('YBF2','YBG2','YBL2','YBRE','YBFG')) AND (ZOH_BLS08_IDL.SOLD_TO Like '1%') AND (ZOH_BLS08_IDL.AB_FKSTO<>'x') AND (ZOH_SDS46_IDL.ZACT_DAT Is Not Null)
OR (ZOH_BLS08_IDL.GT_BSTKD Like ?) AND (ZOH_BLS08_IDL.MATERIAL Like ?) AND (ZOH_SDS46_IDL.SERNO Like ?) AND (ZOH_BLS08_IDL.BILL_TYPE In ('YBF2','YBG2','YBL2','YBRE','YBFG')) AND (ZOH_BLS08_IDL.SOLD_TO Like '1%') AND (ZOH_BLS08_IDL.AB_FKSTO<>'x') AND (ZOH_SDS46_IDL.ZACT_DAT Is Not Null)
)
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top