PDA

View Full Version : [ACCESS]Report di due query


Do85
17-11-2008, 13:21
Ragazzi ho un problema con Access... Ho una database dal quale prelievo con due query dati differenti che non riesco a legare tra loro e devo inserirli nello stesso report, possibile che non si possa fare...? Non sono pratico di VB e speravo di non doverci arrivare, anche se un giorno mi piacerebbe fare pratica.

Grazie!

yggdrasil
17-11-2008, 13:24
se ci fai vedere le due query forse possiamo aiutarti
e già che ci sei le relazioni tra le tabelle interessate dalle query non sarebbe male vederle

Do85
17-11-2008, 13:41
Mmm come posso farvele vedere? Il codice SQL è lungo e incasinato perchè ho molti criteri.
In pratica ho una tabella con le compilazioni dei cartellini che mi permettono di effettuare delle statistiche su un report; in un'altra tabella ho i cartellini che invece non vengono compilati e tramite una query estraggo questi altri dati. Ora i record compilati e non compilati sono giustamente differenti e non riesco a legare le due query, vorrei che il report potesse andare a prendere i dati dalle due query divise.

yggdrasil
17-11-2008, 13:52
Mmm come posso farvele vedere? Il codice SQL è lungo e incasinato perchè ho molti criteri.
In pratica ho una tabella con le compilazioni dei cartellini che mi permettono di effettuare delle statistiche su un report; in un'altra tabella ho i cartellini che invece non vengono compilati e tramite una query estraggo questi altri dati. Ora i record compilati e non compilati sono giustamente differenti e non riesco a legare le due query, vorrei che il report potesse andare a prendere i dati dalle due query divise.

non mi sembra complicato copiaincollare l'sql
chi se ne frega se è incasinato, chi lo sa leggere lo capisce

per le relazioni basta fare uno screenshot della vista relazioni di access

MarcoGG
17-11-2008, 14:01
Ho una database dal quale prelievo con due query dati differenti che non riesco a legare tra loro e devo inserirli nello stesso report, possibile che non si possa fare...?


Già provato con UNION ?
Creare una terza Query che fa una cosa del genere :
SELECT * FROM Query1 UNION SELECT * FROM Query2

Do85
17-11-2008, 15:04
No no va bene... era per dire. :D

Questa è la prima

SELECT TimeValue(Dati_Rapporto!InTime) AS OraIn, TimeValue(Dati_Rapporto!RecvTime) AS OraOUT, Dati_Rapporto.Note2, Dati_Rapporto.Note4, Dati_Rapporto.Note3, Dati_Rapporto.Note5, Dati_Rapporto.CardNumber, IIf(((IsNumeric([Note4])) And ([AccountID]=10) And (([Note5]<>"OPERAZIONI NULLE [C/S]") And ([Note5]<>"OPERAZIONE NULLA CARICO"))),+1,0) AS BISIN, IIf(((IsNumeric([Note3])) And ([AccountID]=10) And (([Note5]<>"OPERAZIONI NULLE [C/S]") And ([Note5]<>"OPERAZIONE NULLA SCARICO"))),+1,0) AS BISOUT, IIf(([CTRON]=1),+1,0) AS ONB, Dati_Rapporto.Deleted AS [Badge Cancellato], Dati_Rapporto.CardStatus AS [Stato Badge], Dati_Rapporto.SpareW1 AS [Controllo Trigger], Dati_Rapporto.Link1, Dati_Rapporto.Link3, Dati_Rapporto.Link4, Dati_Rapporto.Des_Uscita, Dati_Rapporto.FirstName, Dati_Rapporto.LastName, Dati_Rapporto.AccountID, Dati_Rapporto.Cod_Uscite, IIf((Not IsEmpty(Dati_Rapporto!LastName)) And (Dati_Rapporto!AccountID=10),+1,0) AS NBIS, Dati_Rapporto.AcctName, DateDiff("s",[OraIn],[OraOut]) AS DD, IIf([DD]>86400,[DD]\86400,0) AS Giorni, [DD]-(86400*[Giorni]) AS Espr1, [Espr1]\3600 AS Espr2, [Espr1]-([Espr2]*3600) AS Espr3, TimeSerial([Espr2],0,[Espr3]) AS DIF, TimeValue([Dati_Rapporto]![RecvTime]) AS Espr4, IIf(IsNumeric([Dati_Rapporto]![Note3]),+1,0)+IIf(IsNumeric([Dati_Rapporto]![Note4]),+1,0)+IIf([CTRON]=1,+1,0) AS Espr5, Dati_Rapporto.RecvTime, IIf([Comp]=1,[DD],0) AS DDC, Dati_Rapporto.Note6, Dati_Rapporto.RecvTime, IIf(IsNumeric([Dati_Rapporto]![Note3]) Or IsNumeric([Dati_Rapporto]![Note4]) Or [CTRON]=1,1,0) AS [Comp], IIf((([Dati_Rapporto]![Note5])='OPERAZIONE NULLA CARICO') Or (([Dati_Rapporto]![Note5])='OPERAZIONE NULLA SCARICO') Or (([Dati_Rapporto]![Note5])='OPERAZIONI NULLE [C/S]'),1,0) AS CTRON
FROM Dati_Rapporto
GROUP BY TimeValue(Dati_Rapporto!InTime), TimeValue(Dati_Rapporto!RecvTime), Dati_Rapporto.Note2, Dati_Rapporto.Note4, Dati_Rapporto.Note3, Dati_Rapporto.Note5, Dati_Rapporto.CardNumber, Dati_Rapporto.Deleted, Dati_Rapporto.CardStatus, Dati_Rapporto.SpareW1, Dati_Rapporto.Link1, Dati_Rapporto.Link3, Dati_Rapporto.Link4, Dati_Rapporto.Des_Uscita, Dati_Rapporto.FirstName, Dati_Rapporto.LastName, Dati_Rapporto.AccountID, Dati_Rapporto.Cod_Uscite, Dati_Rapporto.AcctName, Dati_Rapporto.RecvTime, Dati_Rapporto.Note6, Dati_Rapporto.RecvTime, DateValue(Dati_Rapporto!RecvTime)
HAVING (((Dati_Rapporto.Note2) Is Not Null) AND ((Dati_Rapporto.Deleted)=1) AND ((Dati_Rapporto.SpareW1)=0) AND ((Dati_Rapporto.Link4)=22) AND ((Dati_Rapporto.AccountID)=10) AND ((Dati_Rapporto.Cod_Uscite)=4 Or (Dati_Rapporto.Cod_Uscite)=5 Or (Dati_Rapporto.Cod_Uscite)=37 Or (Dati_Rapporto.Cod_Uscite)=38 Or (Dati_Rapporto.Cod_Uscite)=137) AND ((TimeValue([Dati_Rapporto]![RecvTime]))>=([Forms]![RepSezGior]![Testo10]) And (TimeValue([Dati_Rapporto]![RecvTime]))<=([Forms]![RepSezGior]![Testo12])) AND ((([Forms]![RepSezGior]![Testo10])) Is Not Null) AND ((DateValue([Dati_Rapporto]![RecvTime]))=[Forms]![RepSezGior]![DataSezGior])) OR (((Dati_Rapporto.Note5) Like "OPERAZIONE NULLA" Or (Dati_Rapporto.Note5) Like "OPERAZIONI NULLE") AND ((Dati_Rapporto.Deleted)=1) AND ((Dati_Rapporto.SpareW1)=0) AND ((Dati_Rapporto.Link4)=22) AND ((Dati_Rapporto.AccountID)=10) AND ((Dati_Rapporto.Cod_Uscite)=4 Or (Dati_Rapporto.Cod_Uscite)=5 Or (Dati_Rapporto.Cod_Uscite)=37 Or (Dati_Rapporto.Cod_Uscite)=38 Or (Dati_Rapporto.Cod_Uscite)=137) AND ((TimeValue([Dati_Rapporto]![RecvTime]))>=([Forms]![RepSezGior]![Testo10]) And (TimeValue([Dati_Rapporto]![RecvTime]))<=([Forms]![RepSezGior]![Testo12])) AND ((([Forms]![RepSezGior]![Testo10])) Is Not Null) AND ((DateValue([Dati_Rapporto]![RecvTime]))=[Forms]![RepSezGior]![DataSezGior])) OR (((Dati_Rapporto.Note3) Is Not Null) AND ((Dati_Rapporto.Deleted)=1) AND ((Dati_Rapporto.SpareW1)=0) AND ((Dati_Rapporto.Link4)=22) AND ((Dati_Rapporto.AccountID)=10) AND ((Dati_Rapporto.Cod_Uscite)=4 Or (Dati_Rapporto.Cod_Uscite)=5 Or (Dati_Rapporto.Cod_Uscite)=37 Or (Dati_Rapporto.Cod_Uscite)=38 Or (Dati_Rapporto.Cod_Uscite)=137) AND ((TimeValue([Dati_Rapporto]![RecvTime]))>=([Forms]![RepSezGior]![Testo10]) And (TimeValue([Dati_Rapporto]![RecvTime]))<=([Forms]![RepSezGior]![Testo12])) AND ((([Forms]![RepSezGior]![Testo10])) Is Not Null) AND ((DateValue([Dati_Rapporto]![RecvTime]))=[Forms]![RepSezGior]![DataSezGior])) OR (((Dati_Rapporto.Note4) Is Not Null) AND ((Dati_Rapporto.Deleted)=1) AND ((Dati_Rapporto.SpareW1)=0) AND ((Dati_Rapporto.Link4)=22) AND ((Dati_Rapporto.AccountID)=10) AND ((Dati_Rapporto.Cod_Uscite)=4 Or (Dati_Rapporto.Cod_Uscite)=5 Or (Dati_Rapporto.Cod_Uscite)=37 Or (Dati_Rapporto.Cod_Uscite)=38 Or (Dati_Rapporto.Cod_Uscite)=137) AND ((TimeValue([Dati_Rapporto]![RecvTime]))>=([Forms]![RepSezGior]![Testo10]) And (TimeValue([Dati_Rapporto]![RecvTime]))<=([Forms]![RepSezGior]![Testo12])) AND ((([Forms]![RepSezGior]![Testo10])) Is Not Null) AND ((DateValue([Dati_Rapporto]![RecvTime]))=[Forms]![RepSezGior]![DataSezGior])) OR (((Dati_Rapporto.Note5) Like "OPERAZIONE NULLA" Or (Dati_Rapporto.Note5) Like "OPERAZIONI NULLE") AND ((Dati_Rapporto.Deleted)=1) AND ((Dati_Rapporto.SpareW1)=0) AND ((Dati_Rapporto.Link4)=22) AND ((Dati_Rapporto.AccountID)=10) AND ((Dati_Rapporto.Cod_Uscite)=4 Or (Dati_Rapporto.Cod_Uscite)=5 Or (Dati_Rapporto.Cod_Uscite)=37 Or (Dati_Rapporto.Cod_Uscite)=38 Or (Dati_Rapporto.Cod_Uscite)=137) AND ((([Forms]![RepSezGior]![Testo10])) Is Null) AND ((DateValue([Dati_Rapporto]![RecvTime]))=[Forms]![RepSezGior]![DataSezGior])) OR (((Dati_Rapporto.Note3) Is Not Null) AND ((Dati_Rapporto.Deleted)=1) AND ((Dati_Rapporto.SpareW1)=0) AND ((Dati_Rapporto.Link4)=22) AND ((Dati_Rapporto.AccountID)=10) AND ((Dati_Rapporto.Cod_Uscite)=4 Or (Dati_Rapporto.Cod_Uscite)=5 Or (Dati_Rapporto.Cod_Uscite)=37 Or (Dati_Rapporto.Cod_Uscite)=38 Or (Dati_Rapporto.Cod_Uscite)=137) AND ((([Forms]![RepSezGior]![Testo10])) Is Null) AND ((DateValue([Dati_Rapporto]![RecvTime]))=[Forms]![RepSezGior]![DataSezGior])) OR (((Dati_Rapporto.Note4) Is Not Null) AND ((Dati_Rapporto.Deleted)=1) AND ((Dati_Rapporto.SpareW1)=0) AND ((Dati_Rapporto.Link4)=22) AND ((Dati_Rapporto.AccountID)=10) AND ((Dati_Rapporto.Cod_Uscite)=4 Or (Dati_Rapporto.Cod_Uscite)=5 Or (Dati_Rapporto.Cod_Uscite)=37 Or (Dati_Rapporto.Cod_Uscite)=38 Or (Dati_Rapporto.Cod_Uscite)=137) AND ((([Forms]![RepSezGior]![Testo10])) Is Null) AND ((DateValue([Dati_Rapporto]![RecvTime]))=[Forms]![RepSezGior]![DataSezGior])) OR (((Dati_Rapporto.Note2) Is Not Null) AND ((Dati_Rapporto.Deleted)=1) AND ((Dati_Rapporto.SpareW1)=0) AND ((Dati_Rapporto.Link4)=22) AND ((Dati_Rapporto.AccountID)=10) AND ((Dati_Rapporto.Cod_Uscite)=4 Or (Dati_Rapporto.Cod_Uscite)=5 Or (Dati_Rapporto.Cod_Uscite)=37 Or (Dati_Rapporto.Cod_Uscite)=38 Or (Dati_Rapporto.Cod_Uscite)=137) AND ((([Forms]![RepSezGior]![Testo10])) Is Null) AND ((DateValue([Dati_Rapporto]![RecvTime]))=[Forms]![RepSezGior]![DataSezGior]))
ORDER BY Dati_Rapporto.RecvTime;

Questa è la seconda.

SELECT NonCompilati.Note3 AS Espr1, NonCompilati.Note4 AS Espr2, NonCompilati.Note5 AS Espr3, NonCompilati.Note8 AS Espr4, NonCompilati.Note31 AS Espr5, NonCompilati.Deleted AS Espr6, NonCompilati.SpareW1 AS Espr7, NonCompilati.CardStatus AS Espr8, NonCompilati.Link1 AS Espr9, NonCompilati.AcctName AS Espr10, NonCompilati.FirstName AS Espr11, NonCompilati.LastName AS Espr12, NonCompilati.CardID AS Espr13, NonCompilati.AccountID AS Espr14, NonCompilati.RecvTime AS Espr15, NonCompilati.CardNumber AS Espr16, NonCompilati.InTime AS Espr17, +1 AS Tot, NonCompilati.Link4 AS Espr18
FROM NonCompilati
WHERE ((([NonCompilati].[Note3]) Is Null) AND (([NonCompilati].[Note4]) Is Null) AND (([NonCompilati].[Note5]) Is Null) AND (([NonCompilati].[Note8])<>"Carico" And ([NonCompilati].[Note8])<>"Scarico" And ([NonCompilati].[Note8])<>"Operazione Nulla") AND (([NonCompilati].[Note31])<>"Dogana Merce Varia") AND (([NonCompilati].[SpareW1])=0) AND (([NonCompilati].[Link1])=4 Or ([NonCompilati].[Link1])=5 Or ([NonCompilati].[Link1])=37 Or ([NonCompilati].[Link1])=38 Or ([NonCompilati].[Link1])=137) AND (([NonCompilati].[AcctName])=IIf(IsNull([Forms]![RepSezGior]![Comb5]),([NonCompilati].[AcctName]),[Forms]![RepSezGior]![Comb5])) AND (([NonCompilati].[AccountID])<>27 And ([NonCompilati].[AccountID])<>25 And ([NonCompilati].[AccountID])<>28 And ([NonCompilati].[AccountID])<>29 And ([NonCompilati].[AccountID])<>30 And ([NonCompilati].[AccountID])<>31 And ([NonCompilati].[AccountID])<>32 And ([NonCompilati].[AccountID])<>33 And ([NonCompilati].[AccountID])<>34) AND ((DateValue([NonCompilati]![RecvTime]))=[Forms]![RepSezGior]![DataSezGior])) OR ((([NonCompilati].[Note3]) Is Null) AND (([NonCompilati].[Note4]) Is Null) AND (([NonCompilati].[Note5])<>"Operazioni Nulle [C/S]" And ([NonCompilati].[Note5])<>"Operazione Nulla Carico" And ([NonCompilati].[Note5])<>"Operazione Nulla Scarico") AND (([NonCompilati].[Note8]) Is Null) AND (([NonCompilati].[Note31]) Is Null) AND (([NonCompilati].[SpareW1])=0) AND (([NonCompilati].[Link1])=4 Or ([NonCompilati].[Link1])=5 Or ([NonCompilati].[Link1])=37 Or ([NonCompilati].[Link1])=38 Or ([NonCompilati].[Link1])=137) AND (([NonCompilati].[AcctName])=IIf(IsNull([Forms]![RepSezGior]![Comb5]),([NonCompilati].[AcctName]),[Forms]![RepSezGior]![Comb5])) AND (([NonCompilati].[AccountID])<>27 And ([NonCompilati].[AccountID])<>25 And ([NonCompilati].[AccountID])<>28 And ([NonCompilati].[AccountID])<>29 And ([NonCompilati].[AccountID])<>30 And ([NonCompilati].[AccountID])<>31 And ([NonCompilati].[AccountID])<>32 And ([NonCompilati].[AccountID])<>33 And ([NonCompilati].[AccountID])<>34) AND ((DateValue([NonCompilati]![RecvTime]))=[Forms]![RepSezGior]![DataSezGior]))
ORDER BY NonCompilati.RecvTime;


Non l'ho fatta usando l'sql ma l'editor di access.

MarcoGG
17-11-2008, 17:40
:eek: :D
Ma daaaaiii, che roba è ?!
:rotfl:
Credi davvero che qualcuno si metta ad interpretare quella roba ?

akyra
18-11-2008, 07:45
No no va bene... era per dire. :D

Questa è la prima

SELECT TimeValue(Dati_Rapporto!InTime) AS OraIn, TimeValue(Dati_Rapporto!RecvTime) AS OraOUT, Dati_Rapporto.Note2, Dati_Rapporto.Note4, Dati_Rapporto.Note3, Dati_Rapporto.Note5, Dati_Rapporto.CardNumber, IIf(((IsNumeric([Note4])) And ([AccountID]=10) And (([Note5]<>"OPERAZIONI NULLE [C/S]") And ([Note5]<>"OPERAZIONE NULLA CARICO"))),+1,0) AS BISIN, IIf(((IsNumeric([Note3])) And ([AccountID]=10) And (([Note5]<>"OPERAZIONI NULLE [C/S]") And ([Note5]<>"OPERAZIONE NULLA SCARICO"))),+1,0) AS BISOUT, IIf(([CTRON]=1),+1,0) AS ONB, Dati_Rapporto.Deleted AS [Badge Cancellato], Dati_Rapporto.CardStatus AS [Stato Badge], Dati_Rapporto.SpareW1 AS [Controllo Trigger], Dati_Rapporto.Link1, Dati_Rapporto.Link3, Dati_Rapporto.Link4, Dati_Rapporto.Des_Uscita, Dati_Rapporto.FirstName, Dati_Rapporto.LastName, Dati_Rapporto.AccountID, Dati_Rapporto.Cod_Uscite, IIf((Not IsEmpty(Dati_Rapporto!LastName)) And (Dati_Rapporto!AccountID=10),+1,0) AS NBIS, Dati_Rapporto.AcctName, DateDiff("s",[OraIn],[OraOut]) AS DD, IIf([DD]>86400,[DD]\86400,0) AS Giorni, [DD]-(86400*[Giorni]) AS Espr1, [Espr1]\3600 AS Espr2, [Espr1]-([Espr2]*3600) AS Espr3, TimeSerial([Espr2],0,[Espr3]) AS DIF, TimeValue([Dati_Rapporto]![RecvTime]) AS Espr4, IIf(IsNumeric([Dati_Rapporto]![Note3]),+1,0)+IIf(IsNumeric([Dati_Rapporto]![Note4]),+1,0)+IIf([CTRON]=1,+1,0) AS Espr5, Dati_Rapporto.RecvTime, IIf([Comp]=1,[DD],0) AS DDC, Dati_Rapporto.Note6, Dati_Rapporto.RecvTime, IIf(IsNumeric([Dati_Rapporto]![Note3]) Or IsNumeric([Dati_Rapporto]![Note4]) Or [CTRON]=1,1,0) AS [Comp], IIf((([Dati_Rapporto]![Note5])='OPERAZIONE NULLA CARICO') Or (([Dati_Rapporto]![Note5])='OPERAZIONE NULLA SCARICO') Or (([Dati_Rapporto]![Note5])='OPERAZIONI NULLE [C/S]'),1,0) AS CTRON
FROM Dati_Rapporto
GROUP BY TimeValue(Dati_Rapporto!InTime), TimeValue(Dati_Rapporto!RecvTime), Dati_Rapporto.Note2, Dati_Rapporto.Note4, Dati_Rapporto.Note3, Dati_Rapporto.Note5, Dati_Rapporto.CardNumber, Dati_Rapporto.Deleted, Dati_Rapporto.CardStatus, Dati_Rapporto.SpareW1, Dati_Rapporto.Link1, Dati_Rapporto.Link3, Dati_Rapporto.Link4, Dati_Rapporto.Des_Uscita, Dati_Rapporto.FirstName, Dati_Rapporto.LastName, Dati_Rapporto.AccountID, Dati_Rapporto.Cod_Uscite, Dati_Rapporto.AcctName, Dati_Rapporto.RecvTime, Dati_Rapporto.Note6, Dati_Rapporto.RecvTime, DateValue(Dati_Rapporto!RecvTime)
HAVING (((Dati_Rapporto.Note2) Is Not Null) AND ((Dati_Rapporto.Deleted)=1) AND ((Dati_Rapporto.SpareW1)=0) AND ((Dati_Rapporto.Link4)=22) AND ((Dati_Rapporto.AccountID)=10) AND ((Dati_Rapporto.Cod_Uscite)=4 Or (Dati_Rapporto.Cod_Uscite)=5 Or (Dati_Rapporto.Cod_Uscite)=37 Or (Dati_Rapporto.Cod_Uscite)=38 Or (Dati_Rapporto.Cod_Uscite)=137) AND ((TimeValue([Dati_Rapporto]![RecvTime]))>=([Forms]![RepSezGior]![Testo10]) And (TimeValue([Dati_Rapporto]![RecvTime]))<=([Forms]![RepSezGior]![Testo12])) AND ((([Forms]![RepSezGior]![Testo10])) Is Not Null) AND ((DateValue([Dati_Rapporto]![RecvTime]))=[Forms]![RepSezGior]![DataSezGior])) OR (((Dati_Rapporto.Note5) Like "OPERAZIONE NULLA" Or (Dati_Rapporto.Note5) Like "OPERAZIONI NULLE") AND ((Dati_Rapporto.Deleted)=1) AND ((Dati_Rapporto.SpareW1)=0) AND ((Dati_Rapporto.Link4)=22) AND ((Dati_Rapporto.AccountID)=10) AND ((Dati_Rapporto.Cod_Uscite)=4 Or (Dati_Rapporto.Cod_Uscite)=5 Or (Dati_Rapporto.Cod_Uscite)=37 Or (Dati_Rapporto.Cod_Uscite)=38 Or (Dati_Rapporto.Cod_Uscite)=137) AND ((TimeValue([Dati_Rapporto]![RecvTime]))>=([Forms]![RepSezGior]![Testo10]) And (TimeValue([Dati_Rapporto]![RecvTime]))<=([Forms]![RepSezGior]![Testo12])) AND ((([Forms]![RepSezGior]![Testo10])) Is Not Null) AND ((DateValue([Dati_Rapporto]![RecvTime]))=[Forms]![RepSezGior]![DataSezGior])) OR (((Dati_Rapporto.Note3) Is Not Null) AND ((Dati_Rapporto.Deleted)=1) AND ((Dati_Rapporto.SpareW1)=0) AND ((Dati_Rapporto.Link4)=22) AND ((Dati_Rapporto.AccountID)=10) AND ((Dati_Rapporto.Cod_Uscite)=4 Or (Dati_Rapporto.Cod_Uscite)=5 Or (Dati_Rapporto.Cod_Uscite)=37 Or (Dati_Rapporto.Cod_Uscite)=38 Or (Dati_Rapporto.Cod_Uscite)=137) AND ((TimeValue([Dati_Rapporto]![RecvTime]))>=([Forms]![RepSezGior]![Testo10]) And (TimeValue([Dati_Rapporto]![RecvTime]))<=([Forms]![RepSezGior]![Testo12])) AND ((([Forms]![RepSezGior]![Testo10])) Is Not Null) AND ((DateValue([Dati_Rapporto]![RecvTime]))=[Forms]![RepSezGior]![DataSezGior])) OR (((Dati_Rapporto.Note4) Is Not Null) AND ((Dati_Rapporto.Deleted)=1) AND ((Dati_Rapporto.SpareW1)=0) AND ((Dati_Rapporto.Link4)=22) AND ((Dati_Rapporto.AccountID)=10) AND ((Dati_Rapporto.Cod_Uscite)=4 Or (Dati_Rapporto.Cod_Uscite)=5 Or (Dati_Rapporto.Cod_Uscite)=37 Or (Dati_Rapporto.Cod_Uscite)=38 Or (Dati_Rapporto.Cod_Uscite)=137) AND ((TimeValue([Dati_Rapporto]![RecvTime]))>=([Forms]![RepSezGior]![Testo10]) And (TimeValue([Dati_Rapporto]![RecvTime]))<=([Forms]![RepSezGior]![Testo12])) AND ((([Forms]![RepSezGior]![Testo10])) Is Not Null) AND ((DateValue([Dati_Rapporto]![RecvTime]))=[Forms]![RepSezGior]![DataSezGior])) OR (((Dati_Rapporto.Note5) Like "OPERAZIONE NULLA" Or (Dati_Rapporto.Note5) Like "OPERAZIONI NULLE") AND ((Dati_Rapporto.Deleted)=1) AND ((Dati_Rapporto.SpareW1)=0) AND ((Dati_Rapporto.Link4)=22) AND ((Dati_Rapporto.AccountID)=10) AND ((Dati_Rapporto.Cod_Uscite)=4 Or (Dati_Rapporto.Cod_Uscite)=5 Or (Dati_Rapporto.Cod_Uscite)=37 Or (Dati_Rapporto.Cod_Uscite)=38 Or (Dati_Rapporto.Cod_Uscite)=137) AND ((([Forms]![RepSezGior]![Testo10])) Is Null) AND ((DateValue([Dati_Rapporto]![RecvTime]))=[Forms]![RepSezGior]![DataSezGior])) OR (((Dati_Rapporto.Note3) Is Not Null) AND ((Dati_Rapporto.Deleted)=1) AND ((Dati_Rapporto.SpareW1)=0) AND ((Dati_Rapporto.Link4)=22) AND ((Dati_Rapporto.AccountID)=10) AND ((Dati_Rapporto.Cod_Uscite)=4 Or (Dati_Rapporto.Cod_Uscite)=5 Or (Dati_Rapporto.Cod_Uscite)=37 Or (Dati_Rapporto.Cod_Uscite)=38 Or (Dati_Rapporto.Cod_Uscite)=137) AND ((([Forms]![RepSezGior]![Testo10])) Is Null) AND ((DateValue([Dati_Rapporto]![RecvTime]))=[Forms]![RepSezGior]![DataSezGior])) OR (((Dati_Rapporto.Note4) Is Not Null) AND ((Dati_Rapporto.Deleted)=1) AND ((Dati_Rapporto.SpareW1)=0) AND ((Dati_Rapporto.Link4)=22) AND ((Dati_Rapporto.AccountID)=10) AND ((Dati_Rapporto.Cod_Uscite)=4 Or (Dati_Rapporto.Cod_Uscite)=5 Or (Dati_Rapporto.Cod_Uscite)=37 Or (Dati_Rapporto.Cod_Uscite)=38 Or (Dati_Rapporto.Cod_Uscite)=137) AND ((([Forms]![RepSezGior]![Testo10])) Is Null) AND ((DateValue([Dati_Rapporto]![RecvTime]))=[Forms]![RepSezGior]![DataSezGior])) OR (((Dati_Rapporto.Note2) Is Not Null) AND ((Dati_Rapporto.Deleted)=1) AND ((Dati_Rapporto.SpareW1)=0) AND ((Dati_Rapporto.Link4)=22) AND ((Dati_Rapporto.AccountID)=10) AND ((Dati_Rapporto.Cod_Uscite)=4 Or (Dati_Rapporto.Cod_Uscite)=5 Or (Dati_Rapporto.Cod_Uscite)=37 Or (Dati_Rapporto.Cod_Uscite)=38 Or (Dati_Rapporto.Cod_Uscite)=137) AND ((([Forms]![RepSezGior]![Testo10])) Is Null) AND ((DateValue([Dati_Rapporto]![RecvTime]))=[Forms]![RepSezGior]![DataSezGior]))
ORDER BY Dati_Rapporto.RecvTime;

Questa è la seconda.

SELECT NonCompilati.Note3 AS Espr1, NonCompilati.Note4 AS Espr2, NonCompilati.Note5 AS Espr3, NonCompilati.Note8 AS Espr4, NonCompilati.Note31 AS Espr5, NonCompilati.Deleted AS Espr6, NonCompilati.SpareW1 AS Espr7, NonCompilati.CardStatus AS Espr8, NonCompilati.Link1 AS Espr9, NonCompilati.AcctName AS Espr10, NonCompilati.FirstName AS Espr11, NonCompilati.LastName AS Espr12, NonCompilati.CardID AS Espr13, NonCompilati.AccountID AS Espr14, NonCompilati.RecvTime AS Espr15, NonCompilati.CardNumber AS Espr16, NonCompilati.InTime AS Espr17, +1 AS Tot, NonCompilati.Link4 AS Espr18
FROM NonCompilati
WHERE ((([NonCompilati].[Note3]) Is Null) AND (([NonCompilati].[Note4]) Is Null) AND (([NonCompilati].[Note5]) Is Null) AND (([NonCompilati].[Note8])<>"Carico" And ([NonCompilati].[Note8])<>"Scarico" And ([NonCompilati].[Note8])<>"Operazione Nulla") AND (([NonCompilati].[Note31])<>"Dogana Merce Varia") AND (([NonCompilati].[SpareW1])=0) AND (([NonCompilati].[Link1])=4 Or ([NonCompilati].[Link1])=5 Or ([NonCompilati].[Link1])=37 Or ([NonCompilati].[Link1])=38 Or ([NonCompilati].[Link1])=137) AND (([NonCompilati].[AcctName])=IIf(IsNull([Forms]![RepSezGior]![Comb5]),([NonCompilati].[AcctName]),[Forms]![RepSezGior]![Comb5])) AND (([NonCompilati].[AccountID])<>27 And ([NonCompilati].[AccountID])<>25 And ([NonCompilati].[AccountID])<>28 And ([NonCompilati].[AccountID])<>29 And ([NonCompilati].[AccountID])<>30 And ([NonCompilati].[AccountID])<>31 And ([NonCompilati].[AccountID])<>32 And ([NonCompilati].[AccountID])<>33 And ([NonCompilati].[AccountID])<>34) AND ((DateValue([NonCompilati]![RecvTime]))=[Forms]![RepSezGior]![DataSezGior])) OR ((([NonCompilati].[Note3]) Is Null) AND (([NonCompilati].[Note4]) Is Null) AND (([NonCompilati].[Note5])<>"Operazioni Nulle [C/S]" And ([NonCompilati].[Note5])<>"Operazione Nulla Carico" And ([NonCompilati].[Note5])<>"Operazione Nulla Scarico") AND (([NonCompilati].[Note8]) Is Null) AND (([NonCompilati].[Note31]) Is Null) AND (([NonCompilati].[SpareW1])=0) AND (([NonCompilati].[Link1])=4 Or ([NonCompilati].[Link1])=5 Or ([NonCompilati].[Link1])=37 Or ([NonCompilati].[Link1])=38 Or ([NonCompilati].[Link1])=137) AND (([NonCompilati].[AcctName])=IIf(IsNull([Forms]![RepSezGior]![Comb5]),([NonCompilati].[AcctName]),[Forms]![RepSezGior]![Comb5])) AND (([NonCompilati].[AccountID])<>27 And ([NonCompilati].[AccountID])<>25 And ([NonCompilati].[AccountID])<>28 And ([NonCompilati].[AccountID])<>29 And ([NonCompilati].[AccountID])<>30 And ([NonCompilati].[AccountID])<>31 And ([NonCompilati].[AccountID])<>32 And ([NonCompilati].[AccountID])<>33 And ([NonCompilati].[AccountID])<>34) AND ((DateValue([NonCompilati]![RecvTime]))=[Forms]![RepSezGior]![DataSezGior]))
ORDER BY NonCompilati.RecvTime;


Non l'ho fatta usando l'sql ma l'editor di access.

mmm....più chiaro di così :asd:

ti conviene appoggiare il database su qualche servizio di file hosting (rapidshare?) così ci diamo un occhio



Non l'ho fatta usando l'sql ma l'editor di access.
e lo spero proprio! :D

Do85
18-11-2008, 08:44
Ma io l'ho detto che era un casino...! :D
Comunque vedrò magari di metterlo online e vi do il link.