Originariamente inviato da sky998 percaso mi sto complicando la vita?
Mi sa di si, avresti delle soluzioni piu semplici che ti abbozzo dopo

Originariamente inviato da sky998 il formato ora va dalle 01 alle 24 ed il campo è nel formato numerico
Strano il formato numerico se poi hai come valore 01 ( dovrebbe essere 1 )
Strane anche le ore dalle 01 alle 24 ( dovrebbe essere dalle 00 alle 23 )

Originariamente inviato da sky998 io stavo pensando ad una query incorporata ad altre query .... il risultato dovrei confrontarlo con un'altra tabella simile che però non ha buchi.
Pero qui siamo nella sezione Wundows e Software ..... quindi ti rispondo con VBA
Confesso pero che una query SQL sembra anche a me piu facile.
anche perche tu dici di avere gia un'altra tabella senza buchi,
ti basterebbe metterle in JOIN .....

Originariamente inviato da sky998 .....per non aggiungere ulteriori dati.
la soluzione proposta utilizza una tabella salvata ma intesa come temporanea, in quanto ad ogni utilizzo viene innanzitutto svuotata di tutti i suoi dati per poi essere ripopolata dalla routine con dati aggiornati.

__________________________________________________ ____

Comunque ammesso che la tua tabella si chiami
----- Tabe
TaDax -- Numerico -- la data rappresentata cosi 20130107 - 20131225 (natale)
Tahhh -- Numerico -- L'ora da 01 a 24
TaVal -- Numerico --

Poi hai la tua temporanea
----- xxxx
xxDax -- Testo
xxhhh -- Testo
xxVal -- Testo

Con il codice che ti posto sotto riesci a generarti i tuoi record, ma certamente dovremo rivederlo perche c'è qualche dettaglio sui formati dati che mi sfugge.
codice:
Public Function gggg()


CurrentDb.Execute "DELETE xxxx.* FROM xxxx;"

Dim gi As Long
Dim gf As Long
gi = DMin("[TaDax]", "Tabe", "")
gf = DMax("[TaDax]", "Tabe", "")

Dim di As Date
Dim df As Date
di = Mid(gi, 7, 2) & "/" & Mid(gi, 5, 2) & "/" & Mid(gi, 1, 4)
df = Mid(gf, 7, 2) & "/" & Mid(gf, 5, 2) & "/" & Mid(gf, 1, 4)

Dim hi As Integer
Dim hf As Integer
hi = DMin("[Tahhh]", "Tabe", "Tabe.TaDax = " & gi)
hf = DMax("[Tahhh]", "Tabe", "Tabe.TaDax = " & gf)


' ((Year(x)) & (Right((0 & Month(x)), 2)) & (Right((0 & Day(x)), 2)))
' (Right((0 & y), 2))

Dim x As Date
Dim y As Integer
Dim ssq As String
Dim dd As String
Dim oo As String

For x = di To di
    For y = hi To 24
        dd = ((Year(x)) & (Right((0 & Month(x)), 2)) & (Right((0 & Day(x)), 2)))
        oo = (Right((0 & y), 2))
    
        If (DCount("*", "Tabe", "Tabe.TaDax = " & dd & " AND Tabe.Tahhh = " & oo)) = 0 Then
            ssq = "INSERT INTO xxxx ( xxDax, xxhhh, xxVal ) SELECT '" & dd & "' AS da, '" & oo & "' AS hh, '" & 0 & "' AS va;"
            CurrentDb.Execute ssq
        Else
            ssq = "INSERT INTO xxxx ( xxDax, xxhhh, xxVal ) SELECT Tabe.TaDax, (Right((0 & Tabe.Tahhh),2)) As hh, Tabe.TaVal FROM Tabe WHERE (((Tabe.TaDax)=" & dd & ") AND ((Tabe.Tahhh)=" & oo & "));"
            CurrentDb.Execute ssq
        End If
    Next
Next


For x = di + 1 To df - 1
    For y = 1 To 24
        dd = ((Year(x)) & (Right((0 & Month(x)), 2)) & (Right((0 & Day(x)), 2)))
        oo = (Right((0 & y), 2))
    
        If (DCount("*", "Tabe", "Tabe.TaDax = " & dd & " AND Tabe.Tahhh = " & oo)) = 0 Then
            ssq = "INSERT INTO xxxx ( xxDax, xxhhh, xxVal ) SELECT '" & dd & "' AS da, '" & oo & "' AS hh, '" & 0 & "' AS va;"
            CurrentDb.Execute ssq
        Else
            ssq = "INSERT INTO xxxx ( xxDax, xxhhh, xxVal ) SELECT Tabe.TaDax, (Right((0 & Tabe.Tahhh),2)) As hh, Tabe.TaVal FROM Tabe WHERE (((Tabe.TaDax)=" & dd & ") AND ((Tabe.Tahhh)=" & oo & "));"
            CurrentDb.Execute ssq
        End If
    Next
Next

For x = df To df
    For y = 1 To hf
        dd = ((Year(x)) & (Right((0 & Month(x)), 2)) & (Right((0 & Day(x)), 2)))
        oo = (Right((0 & y), 2))
    
        If (DCount("*", "Tabe", "Tabe.TaDax = " & dd & " AND Tabe.Tahhh = " & oo)) = 0 Then
            ssq = "INSERT INTO xxxx ( xxDax, xxhhh, xxVal ) SELECT '" & dd & "' AS da, '" & oo & "' AS hh, '" & 0 & "' AS va;"
            CurrentDb.Execute ssq
        Else
            ssq = "INSERT INTO xxxx ( xxDax, xxhhh, xxVal ) SELECT Tabe.TaDax, (Right((0 & Tabe.Tahhh),2)) As hh, Tabe.TaVal FROM Tabe WHERE (((Tabe.TaDax)=" & dd & ") AND ((Tabe.Tahhh)=" & oo & "));"
            CurrentDb.Execute ssq
        End If
    Next
Next



End Function

Facci sapere