I have tried to replace the Select Case statement enumerating the different towns,
with the introduction of a Long Variable “town” and the following code:
Dim town As Long
StrAfid = ” AND ((customers.afid)” & town & “”
My replacement is not valid since i receive the message Invaid Null.
May i ask for help ?
Public Function ListOfCustomers(strFormName As String)
strBase = ” SELECT customers.Customerid, customers.CompanyName, customers.afid, tkind.kind, customers.city ” & _
” FROM tkind INNER JOIN customers ON tkind.kindid = customers.kindid ”
strwhere = ” WHERE (((customers.Customerid) ” & strNotIn & “”
Select Case Forms!USysfrmSearchCustomer![Office]
Case 1
StrAfid = ” AND ((customers.afid)=1))”
Case 2
StrAfid = ” AND ((customers.afid)=2))”
Case 3
StrAfid = ” AND ((customers.afid)=3))”
Case 4
StrAfid = ” AND ((customers.afid)=4))”
Case 5
StrAfid = ” AND ((customers.afid)=5))”
Case 6
StrAfid = ” AND ((customers.afid)=6))”
Case 7
StrAfid = ” AND ((customers.afid)=7))”
Case 8
StrAfid = ” AND ((customers.afid)=8))”
Case 9
StrAfid = ” AND ((customers.afid)=9))”
Case 10
StrAfid = ” AND ((customers.afid)=10))”
End Select
Forms(strFormName)!.RowSource = strBase & strwhere & StrAfid & strOrderBy
End Function