Visualizzazione dei risultati da 1 a 8 su 8

Discussione: access: aiuto!!

  1. #1

    access: aiuto!!

    Ho un problema (sai la novità) con access. sto creando un database che elabora dei dati mensili e dopo aver creato una query a campi incrociati mi crea un report. Il problema sorge con i mesi che hanno meno di 31 giorni, in quanto mi si blocca tutto perchè la query che va a creare il report non trova il campo denominato "31". C'è un modo per inserire un criterio che vada a controllare l'esistenza o meno del campo?

  2. #2
    puoi postare la query? forse creandola in un altro modo...

  3. #3
    postare??
    scusa ma sono una novellina! Mi spieghi meglio?

  4. #4
    postare=inviare, in questo caso il codice della query

  5. #5

    scusa....

    allego il codice delle due query. La prima è una query a campi incrociati che mi crea una tabella con le ore lavorate ogni giorno in ogni cantiere, la seconda assegna il valore zero dove trova null.
    Il problema nasce proprio nel passaggio dalla prima alla seconda, perchè se nella prima non si genera il campo 31, la seconda mi va in tilt. MI RENDO CONTO CHE è UN CASINO

    QUERY N. 1


    TRANSFORM Sum([00 TABELLA RIPARTIZIONE COMMESSE]![ORE]) AS ORE
    SELECT [00 TABELLA RIPARTIZIONE COMMESSE].CodDip, [00 TABELLA RIPARTIZIONE COMMESSE].Cognome, [00 TABELLA RIPARTIZIONE COMMESSE].Nome, [00 TABELLA RIPARTIZIONE COMMESSE].GRcausali, [00 TABELLA RIPARTIZIONE COMMESSE].CodCom, [00 TABELLA RIPARTIZIONE COMMESSE].Descrizione, [00 TABELLA RIPARTIZIONE COMMESSE].[COSTO X CAU], [00 TABELLA RIPARTIZIONE COMMESSE].CodCdc, [00 TABELLA RIPARTIZIONE COMMESSE].Abbreviazione, [00 TABELLA RIPARTIZIONE COMMESSE].CDC, [00 TABELLA RIPARTIZIONE COMMESSE].[Desc Mese], Sum([00 TABELLA RIPARTIZIONE COMMESSE].ORE) AS TOTALE, [TOTALE]*[COSTO X CAU] AS [COSTO TOTALE]
    FROM [00 TABELLA RIPARTIZIONE COMMESSE]
    GROUP BY [00 TABELLA RIPARTIZIONE COMMESSE].CodDip, [00 TABELLA RIPARTIZIONE COMMESSE].Cognome, [00 TABELLA RIPARTIZIONE COMMESSE].Nome, [00 TABELLA RIPARTIZIONE COMMESSE].GRcausali, [00 TABELLA RIPARTIZIONE COMMESSE].CodCom, [00 TABELLA RIPARTIZIONE COMMESSE].Descrizione, [00 TABELLA RIPARTIZIONE COMMESSE].[COSTO X CAU], [00 TABELLA RIPARTIZIONE COMMESSE].CodCdc, [00 TABELLA RIPARTIZIONE COMMESSE].Abbreviazione, [00 TABELLA RIPARTIZIONE COMMESSE].CDC, [00 TABELLA RIPARTIZIONE COMMESSE].[Desc Mese]
    ORDER BY [00 TABELLA RIPARTIZIONE COMMESSE].Cognome, [00 TABELLA RIPARTIZIONE COMMESSE].Abbreviazione
    PIVOT [00 TABELLA RIPARTIZIONE COMMESSE].Progressivo;


    QUERY N.2

    SELECT [00 I° Query Report Ore].CodDip, [00 I° Query Report Ore].Cognome, [00 I° Query Report Ore].Nome, [00 I° Query Report Ore].GRcausali, [00 I° Query Report Ore].CodCom, [00 I° Query Report Ore].Descrizione, [00 I° Query Report Ore].[COSTO X CAU], [00 I° Query Report Ore].CodCdc, [00 I° Query Report Ore].Abbreviazione, [00 I° Query Report Ore].CDC, [00 I° Query Report Ore].[Desc Mese], [00 I° Query Report Ore].TOTALE, [00 I° Query Report Ore].[COSTO TOTALE], IIf([00 I° Query Report Ore]![1] Is Null,0,[00 I° Query Report Ore]![1]) AS 1, IIf([00 I° Query Report Ore]![2] Is Null,0,[00 I° Query Report Ore]![2]) AS 2, IIf([00 I° Query Report Ore]![3] Is Null,0,[00 I° Query Report Ore]![3]) AS 3, IIf([00 I° Query Report Ore]![4] Is Null,0,[00 I° Query Report Ore]![4]) AS 4, IIf([00 I° Query Report Ore]![5] Is Null,0,[00 I° Query Report Ore]![5]) AS 5, IIf([00 I° Query Report Ore]![6] Is Null,0,[00 I° Query Report Ore]![6]) AS 6, IIf([00 I° Query Report Ore]![7] Is Null,0,[00 I° Query Report Ore]![7]) AS 7, IIf([00 I° Query Report Ore]![8] Is Null,0,[00 I° Query Report Ore]![8]) AS 8, IIf([00 I° Query Report Ore]![9] Is Null,0,[00 I° Query Report Ore]![9]) AS 9, IIf([00 I° Query Report Ore]![10] Is Null,0,[00 I° Query Report Ore]![10]) AS 10, IIf([00 I° Query Report Ore]![11] Is Null,0,[00 I° Query Report Ore]![11]) AS 11, IIf([00 I° Query Report Ore]![12] Is Null,0,[00 I° Query Report Ore]![12]) AS 12, IIf([00 I° Query Report Ore]![13] Is Null,0,[00 I° Query Report Ore]![13]) AS 13, IIf([00 I° Query Report Ore]![14] Is Null,0,[00 I° Query Report Ore]![14]) AS 14, IIf([00 I° Query Report Ore]![15] Is Null,0,[00 I° Query Report Ore]![15]) AS 15, IIf([00 I° Query Report Ore]![16] Is Null,0,[00 I° Query Report Ore]![16]) AS 16, IIf([00 I° Query Report Ore]![17] Is Null,0,[00 I° Query Report Ore]![17]) AS 17, IIf([00 I° Query Report Ore]![18] Is Null,0,[00 I° Query Report Ore]![18]) AS 18, IIf([00 I° Query Report Ore]![19] Is Null,0,[00 I° Query Report Ore]![19]) AS 19, IIf([00 I° Query Report Ore]![20] Is Null,0,[00 I° Query Report Ore]![20]) AS 20, IIf([00 I° Query Report Ore]![21] Is Null,0,[00 I° Query Report Ore]![21]) AS 21, IIf([00 I° Query Report Ore]![22] Is Null,0,[00 I° Query Report Ore]![22]) AS 22, IIf([00 I° Query Report Ore]![23] Is Null,0,[00 I° Query Report Ore]![23]) AS 23, IIf([00 I° Query Report Ore]![24] Is Null,0,[00 I° Query Report Ore]![24]) AS 24, IIf([00 I° Query Report Ore]![25] Is Null,0,[00 I° Query Report Ore]![25]) AS 25, IIf([00 I° Query Report Ore]![26] Is Null,0,[00 I° Query Report Ore]![26]) AS 26, IIf([00 I° Query Report Ore]![27] Is Null,0,[00 I° Query Report Ore]![27]) AS 27, IIf([00 I° Query Report Ore]![28] Is Null,0,[00 I° Query Report Ore]![28]) AS 28, IIf([00 I° Query Report Ore]![29] Is Null,0,[00 I° Query Report Ore]![29]) AS 29, IIf([00 I° Query Report Ore]![30] Is Null,0,[00 I° Query Report Ore]![30]) AS 30, IIf([00 I° Query Report Ore]![31] Is Null,0,[00 I° Query Report Ore]![31]) AS 31
    FROM [00 I° Query Report Ore]
    GROUP BY [00 I° Query Report Ore].CodDip, [00 I° Query Report Ore].Cognome, [00 I° Query Report Ore].Nome, [00 I° Query Report Ore].GRcausali, [00 I° Query Report Ore].CodCom, [00 I° Query Report Ore].Descrizione, [00 I° Query Report Ore].[COSTO X CAU], [00 I° Query Report Ore].CodCdc, [00 I° Query Report Ore].Abbreviazione, [00 I° Query Report Ore].CDC, [00 I° Query Report Ore].[Desc Mese], [00 I° Query Report Ore].TOTALE, [00 I° Query Report Ore].[COSTO TOTALE], IIf([00 I° Query Report Ore]![1] Is Null,0,[00 I° Query Report Ore]![1]), IIf([00 I° Query Report Ore]![2] Is Null,0,[00 I° Query Report Ore]![2]), IIf([00 I° Query Report Ore]![3] Is Null,0,[00 I° Query Report Ore]![3]), IIf([00 I° Query Report Ore]![4] Is Null,0,[00 I° Query Report Ore]![4]), IIf([00 I° Query Report Ore]![5] Is Null,0,[00 I° Query Report Ore]![5]), IIf([00 I° Query Report Ore]![6] Is Null,0,[00 I° Query Report Ore]![6]), IIf([00 I° Query Report Ore]![7] Is Null,0,[00 I° Query Report Ore]![7]), IIf([00 I° Query Report Ore]![8] Is Null,0,[00 I° Query Report Ore]![8]), IIf([00 I° Query Report Ore]![9] Is Null,0,[00 I° Query Report Ore]![9]), IIf([00 I° Query Report Ore]![10] Is Null,0,[00 I° Query Report Ore]![10]), IIf([00 I° Query Report Ore]![11] Is Null,0,[00 I° Query Report Ore]![11]), IIf([00 I° Query Report Ore]![12] Is Null,0,[00 I° Query Report Ore]![12]), IIf([00 I° Query Report Ore]![13] Is Null,0,[00 I° Query Report Ore]![13]), IIf([00 I° Query Report Ore]![14] Is Null,0,[00 I° Query Report Ore]![14]), IIf([00 I° Query Report Ore]![15] Is Null,0,[00 I° Query Report Ore]![15]), IIf([00 I° Query Report Ore]![16] Is Null,0,[00 I° Query Report Ore]![16]), IIf([00 I° Query Report Ore]![17] Is Null,0,[00 I° Query Report Ore]![17]), IIf([00 I° Query Report Ore]![18] Is Null,0,[00 I° Query Report Ore]![18]), IIf([00 I° Query Report Ore]![19] Is Null,0,[00 I° Query Report Ore]![19]), IIf([00 I° Query Report Ore]![20] Is Null,0,[00 I° Query Report Ore]![20]), IIf([00 I° Query Report Ore]![21] Is Null,0,[00 I° Query Report Ore]![21]), IIf([00 I° Query Report Ore]![22] Is Null,0,[00 I° Query Report Ore]![22]), IIf([00 I° Query Report Ore]![23] Is Null,0,[00 I° Query Report Ore]![23]), IIf([00 I° Query Report Ore]![24] Is Null,0,[00 I° Query Report Ore]![24]), IIf([00 I° Query Report Ore]![25] Is Null,0,[00 I° Query Report Ore]![25]), IIf([00 I° Query Report Ore]![26] Is Null,0,[00 I° Query Report Ore]![26]), IIf([00 I° Query Report Ore]![27] Is Null,0,[00 I° Query Report Ore]![27]), IIf([00 I° Query Report Ore]![28] Is Null,0,[00 I° Query Report Ore]![28]), IIf([00 I° Query Report Ore]![29] Is Null,0,[00 I° Query Report Ore]![29]), IIf([00 I° Query Report Ore]![30] Is Null,0,[00 I° Query Report Ore]![30]), IIf([00 I° Query Report Ore]![31] Is Null,0,[00 I° Query Report Ore]![31]);

  6. #6
    quindi tu hai una tabella cross-tab con in verticale i nomi delle commesse (righe), e in orizzontale il totale delle ore lavorate nel giorno(colonne).

    Poi entra in gioco la seconda query, che dovrebbe mettere 0 dove trova null, giusto?

    Devi farlo per forza con una query, o potresti scrivere del codice?

  7. #7
    allora, le righe sono il cod dip, ovvero il codice dipendente, collegato a codcom (commessa) e grcau (gruppo causali).
    La seconda effettivamente inserisce lo zero dove trova null. Il codice lo scriverei molto volentieri, solo che essendo appunto alle prime armi, ho ancora un po' di difficoltà. Riuscire ad eliminare una query sarebbe cosa gradita, perchè appesantisce solo il tutto!

  8. #8
    quindi, esegui la prima query, che ti riporta un recordset.

    a questo punto leggi il tuo recordset e (campo per campo, anche con un ciclo for each...next, cosi' non ti devi preoccupare del nome del campo) cambi tutte le occorrenze di Null in Zero.

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.