Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Nov 2001
    Posts
    192
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Invalid Null (Access 2000)

    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)![list].RowSource = strBase & strwhere & StrAfid & strOrderBy
    End Function

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Invalid Null (Access 2000)

    You don't have an = in your expression. Also, just putting

    Dim town As Long

    doesn't give it a value, so it will be 0. Try this instead:

    StrAfid = " AND ((customers.afid)=" & Forms!USysfrmSearchCustomer![Office] & "))"

  3. #3
    Lounger
    Join Date
    Dec 2003
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Invalid Null (Access 2000)

    Thank you.


    Regards

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •