Results 1 to 3 of 3
  1. #1
    MLogue9 is offline Novice
    Windows 8 Access 2007
    Join Date
    Jan 2019
    Posts
    22

    Query is missing an operator. SELECT SUM(filesize)...

    SELECT SUM(filesize) FROM tClips WHERE [filename] (LIKE 'c154%' OR [filename] LIKE 'cam2%') AND directoryShort = '14';

    My db takes %, not *, BTW.


    The only thing that is a little funny is the ( could be in behind the first [filename]. Regardless, ACCESS doesn't like this query.

    Here is the code that put together the SQL. It is a heavyweight and this is an optimized version.

    Code:
    Public Sub subtotalsCalc()
    pXname = "subtotalsCalc"
    secs = Now()
    txtCFree = Round(getFreeSpace("C:\", 3), 0) & "GB"
    txtgFree = Round(getFreeSpace("G:\", 3), 0) & "GB"
    CstrSQL = "SELECT sum(fileSize) FROM tClips WHERE directory LIKE 'C:\%'"
    GstrSQL = "SELECT sum(fileSize) FROM tClips WHERE directory LIKE 'G:\%'"
    txtUsedC = Round(Nz(tableRead("DirectSQL", CstrSQL, 0, 0, 0), 0) / 1024 ^ 3, 0) & "GB"
    txtUsedG = Round(Nz(tableRead("DirectSQL", GstrSQL, 0, 0, 0), 0) / 1024 ^ 3, 0) & "GB"
    txtGTS = oNum2(txtUsedC) + oNum2(txtUsedG)
    'SQL Snipets
    strSQLpart0 = " SELECT SUM(fileSize) FROM tClips WHERE directoryShort "
    strSQLpart1 = " SELECT SUM(filesize) FROM tClips WHERE [filename] "
    strSQLpart2 = " SELECT SUM(filesize) FROM tClips WHERE (dateDD BETWEEN "
    strSQLpartCount = "SELECT count(fileSize) from tclips WHERE directoryShort "
    strSQLpart14 = " AND directoryShort = '14';"
    strSQLpart15 = " AND directoryShort = '15';"
    strSQLpart16 = " AND directoryShort = '16';"
    strSQLpart17 = " AND directoryShort = '17';"
    strSQLpart18 = " AND directoryShort = '18';"
    strSQLpart19 = " AND directoryShort = '19';"
    strSQLpartSelected = " AND directory LIKE '*selected%';"
    strSQLpartselected1 = " SELECT SUM(filesize) FROM tClips WHERE ([filename] (LIKE "
    strSQLpartAncient = " AND directoryShort = 'ancientArchive';"
    strSQLpartNew = " AND directoryShort = 'new';"
    strSQLpartWeek = " AND directoryShort = 'week';"
    strSQLpartbiWeek = " AND directoryShort = 'biweek';"
    'end SQL Snipets
    size14SQL = strSQLpart0 & " = '14'"
    size14 = Round(Nz(tableRead("DirectSQL", size14SQL, 0, 0, 0), 0) / 1024 ^ 3, 0) & "GB"
    size15SQL = strSQLpart0 & "= '15'"
    size15 = Round(Nz(tableRead("DirectSQL", size15SQL, 0, 0, 0), 0) / 1024 ^ 3, 0) & "GB"
    size16SQL = strSQLpart0 & "= '16'"
    size16 = Round(Nz(tableRead("DirectSQL", size16SQL, 0, 0, 0), 0) / 1024 ^ 3, 0) & "GB"
    size17SQL = strSQLpart0 & "= '17'"
    size17 = Round(Nz(tableRead("DirectSQL", size17SQL, 0, 0, 0), 0) / 1024 ^ 3, 0) & "GB"
    size18SQL = strSQLpart0 & "= '18'"
    size18 = Round(Nz(tableRead("DirectSQL", size18SQL, 0, 0, 0), 0) / 1024 ^ 3, 0) & "GB"
    size19SQL = strSQLpart0 & "= '19'"
    size19 = Round(Nz(tableRead("DirectSQL", size19SQL, 0, 0, 0), 0) / 1024 ^ 3, 0) & "GB"
    sizenewSQL = strSQLpart0 & "= 'New'"
    sizeNew = Round(Nz(tableRead("DirectSQL", sizenewSQL, 0, 0, 0), 0) / 1024 ^ 3, 0) & "GB"
    sizeweekSQL = strSQLpart0 & "= 'week'"
    sizeWeek = Round(Nz(tableRead("DirectSQL", sizeweekSQL, 0, 0, 0), 0) / 1024 ^ 3, 0) & "GB"
    sizeancientSQL = strSQLpart0 & "= 'archiveAncient'"
    sizeAncient = Round(Nz(tableRead("DirectSQL", sizeancientSQL, 0, 0, 0), 0) / 1024 ^ 3, 0) & "GB"
    sizeSelectedSQL = "SELECT sum(fileSize) FROM tClips WHERE directory like '*selected%'"
    sizeSelected = Round(Nz(tableRead("DirectSQL", sizeSelectedSQL, 0, 0, 0), 0) / 1024 ^ 3, 0) & "GB"
    strSQL = strSQLpart0 & "= 'biweek'"
    sizeBiWeek = Round(Nz(tableRead("DirectSQL", strSQL, 0, 0, 0), 0) / 1024 ^ 3, 0) & "GB"
    strSQL = strSQLpart0 & "= 'tento31'"
    sizeTento31 = Nz(tableRead("DirectSQL", strSQL, 0, 0, 0), 0)
    strSQL = strSQLpartCount & "= '14';"
    no14 = Nz(tableRead("DirectSQL", strSQL, 0, 0, 0), 0)
    strSQL = strSQLpartCount & "= '15';"
    no15 = Nz(tableRead("DirectSQL", strSQL, 0, 0, 0), 0)
    strSQL = strSQLpartCount & "= '16';"
    no16 = Nz(tableRead("DirectSQL", strSQL, 0, 0, 0), 0)
    strSQL = strSQLpartCount & "= '17';"
    no17 = Nz(tableRead("DirectSQL", strSQL, 0, 0, 0), 0)
    strSQL = strSQLpartCount & "= '18';"
    no18 = Nz(tableRead("DirectSQL", strSQL, 0, 0, 0), 0)
    strSQL = strSQLpartCount & "= '19';"
    no19 = Nz(tableRead("DirectSQL", strSQL, 0, 0, 0), 0)
    strSQL = "SELECT count(fileSize) from tclips WHERE directory LIKE '%selected%';"
    noSelected = Nz(tableRead("DirectSQL", strSQL, 0, 0, 0), 0)
    strSQL = strSQLpartCount & "= 'new';"
    noNew = Nz(tableRead("DirectSQL", strSQL, 0, 0, 0), 0)
    strSQL = strSQLpartCount & "= 'week';"
    noWeek = Nz(tableRead("DirectSQL", strSQL, 0, 0, 0), 0)
    strSQL = strSQLpartCount & " = 'biweek';"
    noBiWeek = Nz(tableRead("DirectSQL", strSQL, 0, 0, 0), 0)
    strSQL = strSQLpartCount & "= 'archiveAncient';"
    noAncient = Nz(tableRead("DirectSQL", strSQL, 0, 0, 0), 0)
    strSQL = strSQLpartCount & "= 'TenTo31';"
    noTenTo31 = Nz(tableRead("DirectSQL", strSQL, 0, 0, 0), 0)
    usb = 0
    cam2 = 0
    cam3 = 0
    cam4 = 0
    c151 = 0
    c152 = 0
    c153 = 0
    c154 = 0
    c155 = 0
    c156 = 0
    c157 = 0
    c158 = 0
    d15 = 0
    d610 = 0
    d1115 = 0
    d1620 = 0
    d2125 = 0
    d2631 = 0
    If (chk14 = True) Then
        usb = oNum2(Nz(usb, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'usb%' " & strSQLpart14, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c151 = oNum2(Nz(c151, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'cam1%' " & strSQLpart14, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
         
        c151 = oNum2(Nz(c151, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'c151%' " & strSQLpart14, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c152 = oNum2(Nz(c152, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "(LIKE 'c152%' OR 'cam3%') " & strSQLpart14, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c153 = oNum2(Nz(c153, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "(LIKE 'c153%' OR 'cam4%') " & strSQLpart14, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c154 = oNum2(Nz(c154, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "(LIKE 'c154%' OR [filename] LIKE 'cam2%') " & strSQLpart14, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c155 = oNum2(Nz(c155, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'c155%' " & strSQLpart14, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c156 = oNum2(Nz(c156, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'c156%' " & strSQLpart14, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c157 = oNum2(Nz(c157, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'c157%' " & strSQLpart14, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c158 = oNum2(Nz(c158, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'c158%' " & strSQLpart14, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    d15 = oNum2(Nz(d15, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & "1 AND 5) " & strSQLpart14, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    d610 = oNum2(Nz(d610, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 6 AND 10) " & strSQLpart14, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    d1115 = oNum2(Nz(d1115, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 11 AND 15) " & strSQLpart14, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    d1620 = oNum2(Nz(d1620, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 16 AND 20) " & strSQLpart14, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    d2125 = oNum2(Nz(d2125, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 21 AND 25) " & strSQLpart14, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    d2631 = oNum2(Nz(d2631, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 26 AND 31) " & strSQLpart14, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        
        End If
    If (chk15 = True) Then
        usb = oNum2(Nz(usb, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'usb%' " & strSQLpart15, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c151 = oNum2(Nz(c151, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'cam1%' " & strSQLpart15, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
         
        c151 = oNum2(Nz(c151, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'c151%' " & strSQLpart15, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c152 = oNum2(Nz(c152, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "(LIKE 'c152%' OR 'cam3%') " & strSQLpart15, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c153 = oNum2(Nz(c153, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "(LIKE 'c153%' OR 'cam4%') " & strSQLpart15, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c154 = oNum2(Nz(c154, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "(LIKE 'c154%' OR 'cam2%') " & strSQLpart15, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c155 = oNum2(Nz(c155, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'c155%' " & strSQLpart15, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c156 = oNum2(Nz(c156, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'c156%' " & strSQLpart15, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c157 = oNum2(Nz(c157, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'c157%' " & strSQLpart15, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c158 = oNum2(Nz(c158, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'c158%' " & strSQLpart15, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        
        d15 = oNum2(Nz(d15)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 1 AND 5) " & strSQLpart15, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    d610 = oNum2(Nz(d610)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 6 AND 10) " & strSQLpart15, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    d1115 = oNum2(Nz(d1115)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 11 AND 15) " & strSQLpart15, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    d1620 = oNum2(Nz(d1620)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 16 AND 20) " & strSQLpart15, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    d2125 = oNum2(Nz(d2125)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 21 AND 25) " & strSQLpart15, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    d2631 = oNum2(Nz(d2631)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 26 AND 31) " & strSQLpart15, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
      
        End If
    If (chk16 = True) Then
        usb = oNum2(Nz(usb, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'usb%' " & strSQLpart16, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c151 = oNum2(Nz(c151, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'cam1%' " & strSQLpart16, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        
        c151 = oNum2(Nz(c151, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'c151%' " & strSQLpart16, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c152 = oNum2(Nz(c152, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "(LIKE 'c152%' OR 'cam3%') " & strSQLpart16, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c153 = oNum2(Nz(c153, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "(LIKE 'c153%' OR 'cam4%') " & strSQLpart16, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c154 = oNum2(Nz(c154, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "(LIKE 'c154%' OR 'cam2%') " & strSQLpart16, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c155 = oNum2(Nz(c155, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'c155%' " & strSQLpart16, 0, 0, 0) / 1024 ^ 3, 0), 0) & " GB"
        c156 = oNum2(Nz(c156, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'c156%' " & strSQLpart16, 0, 0, 0) / 1024 ^ 3, 0), 0) & " GB"
        c157 = oNum2(Nz(c157, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'c157%' " & strSQLpart16, 0, 0, 0) / 1024 ^ 3, 0), 0) & " GB"
        c158 = oNum2(Nz(c158, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'c158%' " & strSQLpart16, 0, 0, 0) / 1024 ^ 3, 0), 0) & " GB"
        
           d15 = oNum2(Nz(d15, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 1 AND 5) " & strSQLpart16, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    d610 = oNum2(Nz(d610, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 6 AND 10) " & strSQLpart16, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    d1115 = oNum2(Nz(d1115, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 11 AND 15) " & strSQLpart16, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    d1620 = oNum2(Nz(d1620, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 16 AND 20) " & strSQLpart16, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    d2125 = oNum2(Nz(d2125, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 21 AND 25) " & strSQLpart16, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    d2631 = oNum2(Nz(d2531, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 26 AND 31) " & strSQLpart16, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
     
        
        End If
    If (chk17 = True) Then
    usb = oNum2(Nz(usb, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'usb%' " & strSQLpart17, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c151 = oNum2(Nz(c151, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'cam1%' " & strSQLpart17, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        
        c151 = oNum2(Nz(c151, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'c151%' " & strSQLpart17, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c152 = oNum2(Nz(c152, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "(LIKE 'c152%' OR 'cam3%') " & strSQLpart17, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c153 = oNum2(Nz(c153, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "(LIKE 'c153%' OR 'cam4%') " & strSQLpart17, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c154 = oNum2(Nz(c154, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "(LIKE 'c154%' OR 'cam2%') " & strSQLpart17, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c155 = oNum2(Nz(c155, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'c155%' " & strSQLpart17, 0, 0, 0) / 1024 ^ 3, 0), 0) & " GB"
        c156 = oNum2(Nz(c156, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'c156%' " & strSQLpart17, 0, 0, 0) / 1024 ^ 3, 0), 0) & " GB"
        c157 = oNum2(Nz(c157, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'c157%' " & strSQLpart17, 0, 0, 0) / 1024 ^ 3, 0), 0) & " GB"
        c158 = oNum2(Nz(c158, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'c158%' " & strSQLpart17, 0, 0, 0) / 1024 ^ 3, 0), 0) & " GB"
        
           d15 = oNum2(Nz(d15)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 1 AND 5) " & strSQLpart17, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    d610 = oNum2(Nz(d610)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 6 AND 10) " & strSQLpart17, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    d1115 = oNum2(Nz(d1115)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 11 AND 15) " & strSQLpart17, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    d1620 = oNum2(Nz(d1620)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 16 AND 20) " & strSQLpart17, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    d2125 = oNum2(Nz(d2125)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 21 AND 25) " & strSQLpart17, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    d2631 = oNum2(Nz(d2631)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 26 AND 31) " & strSQLpart17, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
     
        End If
        If (chk18 = True) Then
        usb = oNum2(Nz(usb, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'usb%' " & strSQLpart18, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c151 = oNum2(Nz(c151, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'cam1%' " & strSQLpart18, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
         
        c151 = oNum2(Nz(c151, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'c151%' " & strSQLpart18, 0, 0, 0) / 1024 ^ 3, 0), 0) & " GB"
        c152 = oNum2(Nz(c152, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "(LIKE 'c152%' OR 'cam3%') " & strSQLpart18, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c153 = oNum2(Nz(c153, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "(LIKE 'c153%' OR 'cam4%') " & strSQLpart18, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c154 = oNum2(Nz(c154, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "(LIKE 'c154%' OR 'cam2%') " & strSQLpart18, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c155 = oNum2(Nz(c155, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'c155%' " & strSQLpart18, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c156 = oNum2(Nz(c156, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'c156%' " & strSQLpart18, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c157 = oNum2(Nz(c157, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'c157%' " & strSQLpart18, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c158 = oNum2(Nz(c158, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'c158%' " & strSQLpart18, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        
            d15 = oNum2(Nz(d15, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 1 AND 5) " & strSQLpart18, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    d610 = oNum2(Nz(d610, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 6 AND 10) " & strSQLpart18, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    d1115 = oNum2(Nz(d1115, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 11 AND 15) " & strSQLpart18, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    d1620 = oNum2(Nz(d1620, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 16 AND 20) " & strSQLpart18, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    d2125 = oNum2(Nz(d2125, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 21 AND 25) " & strSQLpart18, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    d2631 = oNum2(Nz(d2631, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 26 AND 31) " & strSQLpart18, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        End If
    If (chk19 = True) Then
    usb = oNum2(Nz(usb, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'usb%' " & strSQLpart19, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c151 = oNum2(Nz(c151, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'cam1%' " & strSQLpart19, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        
        c151 = oNum2(Nz(c151, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'c151%' " & strSQLpart19, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c152 = oNum2(Nz(c152, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "(LIKE 'c152%' OR 'cam3%') " & strSQLpart19, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c153 = oNum2(Nz(c153, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "(LIKE 'c153%' OR 'cam4%') " & strSQLpart19, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c154 = oNum2(Nz(c154, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "(LIKE 'c154%' OR 'cam2%') " & strSQLpart19, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c155 = oNum2(Nz(c155, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'c155%' " & strSQLpart19, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c156 = oNum2(Nz(c156, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'c156%' " & strSQLpart19, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c157 = oNum2(Nz(c157, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'c157%' " & strSQLpart19, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c158 = oNum2(Nz(c158, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'c158%' " & strSQLpart19, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        
    d15 = oNum2(Nz(d15, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 1 AND 5) " & strSQLpart19, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    d610 = oNum2(Nz(d610, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 6 AND 10) " & strSQLpart19, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    d1115 = oNum2(Nz(d1115, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 11 AND 15) " & strSQLpart19, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    d1620 = oNum2(Nz(d1620, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 16 AND 20) " & strSQLpart19, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    d2125 = oNum2(Nz(d2125, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 21 AND 25) " & strSQLpart19, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    d2631 = oNum2(Nz(d2631, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 26 AND 31) " & strSQLpart19, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        End If
    If (chkSelected = True) Then
    usb = oNum2(Nz(usb, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'usb%'" & strSQLpartSelected, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c151 = oNum2(Nz(c151, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'am1%'" & strSQLpartSelected, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
         
        c151 = oNum2(Nz(c151, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpartselected1 & " '151%'))" & strSQLpartSelected, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c152 = oNum2(Nz(c152, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpartselected1 & " '152%' OR 'cam3%'))" & strSQLpartSelected, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c153 = oNum2(Nz(c153, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpartselected1 & " '153%' OR 'cam4%'))" & strSQLpartSelected, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c154 = oNum2(Nz(c154, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpartselected1 & " '154%' OR 'cam2%'))" & strSQLpartSelected, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c155 = oNum2(Nz(c155, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpartselected1 & " '155%'))" & strSQLpartSelected, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c156 = oNum2(Nz(c156, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpartselected1 & " '156%'))" & strSQLpartSelected, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c157 = oNum2(Nz(c157, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpartselected1 & " '157%'))" & strSQLpartSelected, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c158 = oNum2(Nz(c158, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpartselected1 & " '158%'))" & strSQLpartSelected, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        
    d15 = oNum2(Nz(d15, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 1 AND 5)" & strSQLpartSelected, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    d610 = oNum2(Nz(d610, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 6 AND 10)" & strSQLpartSelected, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    d1115 = oNum2(Nz(d1115, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 11 AND 15)" & strSQLpartSelected, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    d1620 = oNum2(Nz(d1620, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 16 AND 20)" & strSQLpartSelected, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    d2125 = oNum2(Nz(d2125, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 21 AND 25)" & strSQLpartSelected, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    d2631 = oNum2(Nz(d2631, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 26 AND 31)" & strSQLpartSelected, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        End If
    If (chkAncient = True) Then
    usb = oNum2(Nz(usb, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'usb%'" & strSQLpartAncient, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    c151 = oNum2(Nz(c151, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'Cam1%'" & strSQLpartAncient, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        
        c151 = oNum2(Nz(c151, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'c151%'" & strSQLpartAncient, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c152 = oNum2(Nz(c152, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "(LIKE 'c152%' OR filename LIKE 'Cam3%')" & strSQLpartAncient, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c153 = oNum2(Nz(c153, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "(LIKE 'c153%' OR filename LIKE 'Cam4%')" & strSQLpartAncient, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c154 = oNum2(Nz(c154, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "(LIKE 'c154%' OR filename LIKE 'Cam2%')" & strSQLpartAncient, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c155 = oNum2(Nz(c155, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'c155%'" & strSQLpartAncient, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c156 = oNum2(Nz(c156, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'c156%'" & strSQLpartAncient, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c157 = oNum2(Nz(c157, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'c157%'" & strSQLpartAncient, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c158 = oNum2(Nz(c158, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'c158%'" & strSQLpartAncient, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
       
      d15 = oNum2(Nz(d15, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 1 AND 5)" & strSQLpartAncient, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    d610 = oNum2(Nz(d610, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 6 AND 10)" & strSQLpartAncient, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    d1115 = oNum2(Nz(d1115, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 11 AND 15)" & strSQLpartAncient, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    d1620 = oNum2(Nz(d1620, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 16 AND 20)" & strSQLpartAncient, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    d2125 = oNum2(Nz(d2125, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 21 AND 25)" & strSQLpartAncient, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    d2631 = oNum2(Nz(d2631, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 26 AND 31)" & strSQLpartAncient, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
      
        End If
    If (chkWeek = True) Then
    usb = oNum2(Nz(usb, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'usb%' AND directoryShort = 'week';", 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    c151 = oNum2(Nz(c151, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'cam1%' AND directoryShort = 'week';", 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
          
        c151 = oNum2(Nz(c151, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'c151%' AND " & strSQLpartWeek, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c152 = oNum2(Nz(c152, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "(LIKE 'c152%' OR 'cam3%') AND " & strSQLpartWeek, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c153 = oNum2(Nz(c153, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "(LIKE 'c153%' OR 'cam4%') AND " & strSQLpartWeek, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c154 = oNum2(Nz(c154, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "(LIKE 'c154%' OR 'cam2%') AND " & strSQLpartWeek, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c155 = oNum2(Nz(c155, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'c155%' AND " & strSQLpartWeek, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c156 = oNum2(Nz(c156, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'c156%' AND " & strSQLpartWeek, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c157 = oNum2(Nz(c157, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'c157%' AND " & strSQLpartWeek, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c158 = oNum2(Nz(c158, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'c158%' AND " & strSQLpartWeek, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        
          d15 = oNum2(Nz(d15, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 1 AND 5) AND " & strSQLpartWeek, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    d610 = oNum2(Nz(d610, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 6 AND 10) AND " & strSQLpartWeek, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    d1115 = oNum2(Nz(d1115, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 11 AND 15) AND " & strSQLpartWeek, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    d1620 = oNum2(Nz(d1620, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 16 AND 20) AND " & strSQLpartWeek, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    d2125 = oNum2(Nz(d2125, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 21 AND 25) AND " & strSQLpartWeek, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    d2631 = oNum2(Nz(d2631, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 26 AND 31) AND " & strSQLpartWeek, 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
      
        End If
    If (chkBiWeek = True) Then
    usb = Nz(oNum2(usb), 0) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'usb%' AND directoryShort = 'biweek';", 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    c151 = Nz(oNum2(c151), 0) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'cam1%' AND directoryShort = 'biweek';", 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
         
        c151 = Nz(oNum2(c151), 0) + Nz(Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'c151%' AND directoryShort = 'biweek';", 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB", 0)
        c152 = Nz(oNum2(c152), 0) + Nz(Round(Nz(tableRead("DirectSQL", strSQLpart1 & "(LIKE 'c152%' OR 'cam3%') AND directoryShort = 'biweek';", 0, 0, 0), 0) / 1024 ^ 3, 0), 0) & " GB"
        c153 = Nz(oNum2(c153), 0) + Nz(Round(Nz(tableRead("DirectSQL", strSQLpart1 & "(LIKE 'c153%' OR 'cam4%') AND directoryShort = 'biweek';", 0, 0, 0), 0) / 1024 ^ 3, 0), 0) & " GB"
        c154 = Nz(oNum2(c154), 0) + Nz(Round(Nz(tableRead("DirectSQL", strSQLpart1 & "(LIKE 'c154%' OR 'cam2%') AND directoryShort = 'biweek';", 0, 0, 0), 0) / 1024 ^ 3, 0), 0) & " GB"
        c155 = Nz(oNum2(c155), 0) + Nz(Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'c155%' AND directoryShort = 'biweek';", 0, 0, 0), 0) / 1024 ^ 3, 0), 0) & " GB"
        c156 = Nz(oNum2(c156), 0) + Nz(Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'c156%' AND directoryShort = 'biweek';", 0, 0, 0), 0) / 1024 ^ 3, 0), 0) & " GB"
        c157 = Nz(oNum2(c157), 0) + Nz(Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'c157%' AND directoryShort = 'biweek';", 0, 0, 0), 0) / 1024 ^ 3, 0), 0) & " GB"
        c158 = Nz(oNum2(c158), 0) + Nz(Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'c158%' AND directoryShort = 'biweek';", 0, 0, 0), 0) / 1024 ^ 3, 0), 0) & " GB"
        
    d15 = oNum2(Nz(d15, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 1 AND 5) AND directoryShort = 'biweek';", 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    d610 = oNum2(Nz(d610, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 6 AND 10) AND directoryShort = 'biweek';", 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    d1115 = oNum2(Nz(d1115, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 11 AND 15) AND directoryShort = 'biweek';", 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    d1620 = oNum2(Nz(d1620, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 16 AND 20) AND directoryShort = 'biweek';", 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    d2125 = oNum2(Nz(d2125, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 21 AND 25) AND directoryShort = 'biweek';", 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    d2631 = oNum2(Nz(d2631, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 26 AND 31) AND directoryShort = 'biweek';", 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
      
        End If
    If (chkNew = True) Then
    c151 = oNum2(Nz(c151, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'cam1%' AND directoryShort = 'new';", 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
       usb = oNum2(Nz(usb, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'usb%' AND directoryShort = 'new';", 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
      
        c151 = oNum2(Nz(c151, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'c151%' AND directoryShort = 'new';", 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c152 = oNum2(Nz(c152, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "(LIKE 'c152%' OR 'cam3%') AND directoryShort = 'new';", 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c153 = oNum2(Nz(c153, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "(LIKE 'c153%' OR 'cam4%') AND directoryShort = 'new';", 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c154 = oNum2(Nz(c154, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "(LIKE 'c154%' OR 'cam2%') AND directoryShort = 'new';", 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c155 = oNum2(Nz(c155, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'c155%' AND directoryShort = 'new';", 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c156 = oNum2(Nz(c156, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'c156%' AND directoryShort = 'new';", 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c157 = oNum2(Nz(c157, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'c157%' AND directoryShort = 'new';", 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c158 = oNum2(Nz(c158, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'c158%' AND directoryShort = 'new';", 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        
    d15 = oNum2(Nz(d15, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 1 AND 5) AND directoryShort = 'new';", 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    d610 = oNum2(Nz(d610, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 6 AND 10) AND directoryShort = 'new';", 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    d1115 = oNum2(Nz(d1115, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 11 AND 15) AND directoryShort = 'new';", 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    d1620 = oNum2(Nz(d1620, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 16 AND 20) AND directoryShort = 'new';", 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    d2125 = oNum2(Nz(d2125, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 21 AND 25) AND directoryShort = 'new';", 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
    d2631 = oNum2(Nz(d2631, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 26 AND 31) AND directoryShort = 'new';", 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
      
        End If
       If (chkTento31 = True) Then
        c151 = oNum2(Nz(c151, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'cam1%' AND directoryShort = 'tento31';", 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        usb = oNum2(Nz(usb, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'usb%' AND directoryShort = 'tento31';", 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
      
        c151 = oNum2(Nz(c151, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'c151%' AND directoryShort = 'tento31';", 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c152 = oNum2(Nz(c152, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "(LIKE 'c152%' OR 'cam3%') AND directoryShort = 'tento31';", 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c153 = oNum2(Nz(c153, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "(LIKE 'c153%' OR 'cam4%') AND directoryShort = 'tento31';", 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c154 = oNum2(Nz(c154, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "(LIKE 'c154%' OR 'cam2%') AND directoryShort = 'tento31';", 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c155 = oNum2(Nz(c155, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'c155%' AND directoryShort = 'tento31';", 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c156 = oNum2(Nz(c156, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'c156%' AND directoryShort = 'tento31';", 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c157 = oNum2(Nz(c157, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'c157%' AND directoryShort = 'tento31';", 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        c158 = oNum2(Nz(c158, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart1 & "LIKE 'c158%' AND directoryShort = 'tento31';", 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        
        d15 = oNum2(Nz(d15, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 1 AND 5) AND directoryShort = 'tento31';", 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        d610 = oNum2(Nz(d610, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 6 AND 10) AND directoryShort = 'tento31';", 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        d1115 = oNum2(Nz(d1115, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 11 AND 15) AND directoryShort = 'tento31';", 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        d1620 = oNum2(Nz(d1620, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 16 AND 20) AND directoryShort = 'tento31';", 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        d2125 = oNum2(Nz(d2125, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 21 AND 25) AND directoryShort = 'tento31';", 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
        d2631 = oNum2(Nz(d2631, 0)) + Round(Nz(tableRead("DirectSQL", strSQLpart2 & " 26 AND 31) AND directoryShort = 'tento31';", 0, 0, 0), 0) / 1024 ^ 3, 0) & " GB"
          
        
        camTotal = oNum2(Nz(usb)) + oNum2(Nz(151)) + oNum2(Nz(152)) + oNum2(Nz(153)) + oNum2(Nz(154)) + oNum2(Nz(155)) + oNum2(Nz(156)) + oNum2(Nz(157)) + oNum2(Nz(158))
        daysTotal = oNum2(Nz(d15)) + oNum2(Nz(d610)) + oNum2(Nz(d1115)) + oNum2(Nz(d1620)) + oNum2(Nz(d2125)) + oNum2(Nz(d2631))
        secs = Round((Now() - secs) * 24 * 60 * 60, 1)
        Call CStatus("Subtotal calculations complete in " & secs & "s.", 260, 0, 0, 0)
        End If
        End Sub

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    try using queries instead of sql.
    the query can better eliminate errors.

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    I agree that the parentheses is off. Try

    SELECT SUM(filesize) FROM tClips WHERE ([filename] LIKE 'c154%' OR [filename] LIKE 'cam2%') AND directoryShort = '14';

    If your app needs % rather than * you are either using ADO to open a recordset or passing through to SQL Server or something similar. DAO and Jet/Ace would both want *.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 10-25-2017, 01:47 PM
  2. Missing operator in query expression
    By moneypennie21 in forum SQL Server
    Replies: 11
    Last Post: 05-18-2017, 08:10 AM
  3. Replies: 2
    Last Post: 03-31-2016, 04:28 PM
  4. Replies: 2
    Last Post: 02-17-2014, 10:27 AM
  5. DateDiff Missing Operator? Long Query
    By ewassmer in forum Queries
    Replies: 1
    Last Post: 08-25-2011, 10:46 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums