class= " lineNumbers " del
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
|
class= del
id= " codeSnippet767453 " class= " del ' velocità su qry10002 con le costanti letterali
Funzione pubblica GetDemand ()
Dbs fiochi come base di dati
Qdf fioco come DAO.QueryDef
Rst fioco come DAO.Recordset
sInsert fioco come stringa, sSelect come stringa, sFrom come stringa, sWhere come stringa, sSQL come stringa
lRecordCount fioco come lungamente: lRecordCount = 0
lCounter fioco come lungamente
DoCmd.SetWarnings falso
DoCmd.RunSQL “CANCELLAZIONE * da tblDemand„
'sInsert = “INSERTO in tblDemand„
sSelect = “LOWES.T2398_IFM_FRC_VAL.T024_ITM_NBR PRESCELTO, LOWES.T2398_IFM_FRC_VAL.T063_LCT_NBR, CASO QUANDO ESTREMITÀ ALTRA SEN_END_WK_NBR-SEN_BGN_WK_NBR+1 52-SEN_BGN_WK_NBR+SEN_END_WK_NBR+1 di SEN_BGN_WK_NBR<=SEN_END_WK_NBR ALLORA COME "" che vende il "" di settimane,„ & _
“LOWES.T2355_SEN_PRL.WK1_BAS_IND_FCT+LOWES.T2355_SEN_PRL.WK2_BAS_IND_FCT+LOWES.T2355_SEN_PRL.WK3_BAS_IND_FCT+LOWES.T2355_SEN_PRL.WK4_BAS_IND_FCT+LOWES.T2355_SEN_PRL.WK5_BAS_IND_FCT+LOWES.T2355_SEN_PRL.WK6_BAS_IND_FCT+LOWES.T2355_SEN_PRL.WK7_BAS_IND_FCT+LOWES.T2355_SEN_PRL.WK8_BAS_IND_FCT+LOWES.T2355_SEN_PRL.WK9_BAS_IND_FCT+LOWES.T2355_SEN_PRL.WK10_BAS_IND_FCT+LOWES.T2355_SEN_PRL.WK11_BAS_IND_FCT+LOWES.T2355_SEN_PRL.WK12_BAS_IND_FCT+LOWES.T2355_SEN_PRL.WK13_BAS_IND_FCT COME somma del "" Q1 del "" della Banca dei Regolamenti Internazionali,„ & del _
“LOWES.T2355_SEN_PRL.WK14_BAS_IND_FCT+LOWES.T2355_SEN_PRL.WK15_BAS_IND_FCT+LOWES.T2355_SEN_PRL.WK16_BAS_IND_FCT+LOWES.T2355_SEN_PRL.WK17_BAS_IND_FCT+LOWES.T2355_SEN_PRL.WK18_BAS_IND_FCT+LOWES.T2355_SEN_PRL.WK19_BAS_IND_FCT+LOWES.T2355_SEN_PRL.WK20_BAS_IND_FCT+LOWES.T2355_SEN_PRL.WK21_BAS_IND_FCT+LOWES.T2355_SEN_PRL.WK22_BAS_IND_FCT+LOWES.T2355_SEN_PRL.WK23_BAS_IND_FCT+LOWES.T2355_SEN_PRL.WK24_BAS_IND_FCT+LOWES.T2355_SEN_PRL.WK25_BAS_IND_FCT+LOWES.T2355_SEN_PRL.WK26_BAS_IND_FCT COME somma del "" Q2 del "" della Banca dei Regolamenti Internazionali,„ & del _
“LOWES.T2355_SEN_PRL.WK27_BAS_IND_FCT+LOWES.T2355_SEN_PRL.WK28_BAS_IND_FCT+LOWES.T2355_SEN_PRL.WK29_BAS_IND_FCT+LOWES.T2355_SEN_PRL.WK30_BAS_IND_FCT+LOWES.T2355_SEN_PRL.WK31_BAS_IND_FCT+LOWES.T2355_SEN_PRL.WK32_BAS_IND_FCT+LOWES.T2355_SEN_PRL.WK33_BAS_IND_FCT+LOWES.T2355_SEN_PRL.WK34_BAS_IND_FCT+LOWES.T2355_SEN_PRL.WK35_BAS_IND_FCT+LOWES.T2355_SEN_PRL.WK36_BAS_IND_FCT+LOWES.T2355_SEN_PRL.WK37_BAS_IND_FCT+LOWES.T2355_SEN_PRL.WK38_BAS_IND_FCT+LOWES.T2355_SEN_PRL.WK39_BAS_IND_FCT COME somma del "" Q3 del "" della Banca dei Regolamenti Internazionali,„ & del _
“LOWES.T2355_SEN_PRL.WK40_BAS_IND_FCT+LOWES.T2355_SEN_PRL.WK41_BAS_IND_FCT+LOWES.T2355_SEN_PRL.WK42_BAS_IND_FCT+LOWES.T2355_SEN_PRL.WK43_BAS_IND_FCT+LOWES.T2355_SEN_PRL.WK44_BAS_IND_FCT+LOWES.T2355_SEN_PRL.WK45_BAS_IND_FCT+LOWES.T2355_SEN_PRL.WK46_BAS_IND_FCT+LOWES.T2355_SEN_PRL.WK47_BAS_IND_FCT+LOWES.T2355_SEN_PRL.WK48_BAS_IND_FCT+LOWES.T2355_SEN_PRL.WK49_BAS_IND_FCT+LOWES.T2355_SEN_PRL.WK50_BAS_IND_FCT+LOWES.T2355_SEN_PRL.WK51_BAS_IND_FCT+LOWES.T2355_SEN_PRL.WK52_BAS_IND_FCT COME somma del "" Q4 del """ della Banca dei Regolamenti Internazionali
lo sFrom = “(LOWES.T2354_ITM_LCT_PRL INTERNI UNISCONO LOWES.T2355_SEN_PRL SU LOWES.T2354_ITM_LCT_PRL.T2355_PRL_TAG_ID = LOWES.T2355_SEN_PRL.T2355_PRL_TAG_ID) DA INTERNO UNISCE LOWES.T2398_IFM_FRC_VAL SOPRA (LOWES.T2354_ITM_LCT_PRL.T063_LCT_NBR = LOWES.T2398_IFM_FRC_VAL.T063_LCT_NBR) E (LOWES.T2354_ITM_LCT_PRL.T024_ITM_NBR = LOWES.T2398_IFM_FRC_VAL.T024_ITM_NBR)„
sWhere = “DOVE (LOWES.T2398_IFM_FRC_VAL.T024_ITM_NBR = -1 E LOWES.T2398_IFM_FRC_VAL.T063_LCT_NBR = -1)„
Regolare i dbs = CurrentDb ()
Regolare il rst = dbs.OpenRecordset (“T024_ITM_NBR PRESCELTO, T063_LCT_NBR da Demand_Check_C; ")
Se rst.EOF allora
lRecordCount = 0
Altrimenti
rst.MoveLast
lRecordCount = rst.RecordCount
Concluder se
rst.MoveFirst
Fare mentre non rst.EOF
lCounter = lCounter + 1
sWhere = sWhere & “O (LOWES.T2398_IFM_FRC_VAL.T024_ITM_NBR =„ & rst (“T024_ITM_NBR„) &„ E LOWES.T2398_IFM_FRC_VAL.T063_LCT_NBR = “& rst (“T063_LCT_NBR„) & ") “
Se lCounter > 60 o rst.AbsolutePosition = lRecordCount - 1 allora
sSQL = sInsert & sSelect & sFrom & sWhere '& “CON UR„
Regolare il qdf = CurrentDb () .QueryDefs (“qryPassThrough„)
qdf.SQL = sSQL
DoCmd.OpenQuery “qryDemand„
'sSQL di DoCmd.RunSQL
lCounter = 0
sWhere = “DOVE (LOWES.T2398_IFM_FRC_VAL.T024_ITM_NBR = -1 E LOWES.T2398_IFM_FRC_VAL.T063_LCT_NBR = -1)„ '- 1 = manichino # occuparsi del primo O
Concluder se
rst.MoveNext
Ciclo
DoCmd.SetWarnings allineare
rst. Fine
Funzione di conclusione
|