(Solved) – How filter blank arrays in VBA Ms Access

  • by
(solved)-–-how-filter-blank-arrays-in-vba-ms-access

I’m stuck with an array problem in Ms Access. I have an array Tax class B in Ms Access.

Now the problem is Tax class B has some empty values. These arrays are generated from the code below:

Tax.Add DLookup("TaxClassB", "QryJson", "InvoiceID =" & Me.InvoiceID & " AND ItemesID =" & CStr(i))
Like say: if i = 5 then
 "B"
  ""
 "B"
 ""
 "B"

How can I get rid of those empty elements so that Tax class B becomes only three elements long and then display them in a range of three cells.

I tried the code below today but still it never sorted out my problem

Dim myvar As Variant

    myvar = DLookup("TaxClassB", "QryJson", "InvoiceID =" & Me.InvoiceID & " AND ItemesID =" & CStr(i))
    If Not IsNull(myvar) Then
        If Len(myvar) > 0 Then
            Tax.Add myvar
        End If
    End If

Thanks in advance for any help.

Leave a Reply

Your email address will not be published. Required fields are marked *