Results 1 to 4 of 4

Thread: Error 2501

  1. #1
    Join Date
    Feb 2008
    Posts
    27

    Unanswered: Error 2501

    I keep getting this error when I try to run some code as a search Function. The search I am doing is setup as a Yes/No in the Table, so maybe that is the issue, here is the code I am working with that is giving me the error, I am using the same basic code for 4 other searches and those are working fine, it is just this one:

    'Field 3 Combo Box criteria
    If Nz(Me.Combo32, "") <> "" Then
    If strWHERE <> "" Then strWHERE = strWHERE & " AND "
    strWHERE = strWHERE & "((High_Risk_Tbl.[Legal_Inquiry_Needed]) ='" & Me.Combo32 & "')"
    End If

  2. #2
    Join Date
    May 2005
    Posts
    1,191
    What are the choices from Combo32? I think you need to either have either "TRUE" or "FALSE", so that it evaluates to either:

    strWHERE = strWHERE & "((High_Risk_Tbl.[Legal_Inquiry_Needed]) = TRUE)"

    or

    strWHERE = strWHERE & "((High_Risk_Tbl.[Legal_Inquiry_Needed]) = FALSE)"

    If Combo32 returns anything else it won't work (except 0 or -1, the numerical equivalents to TRUE and FALSE in Access). And you won't need the apostrophes as it's not a string, it's a Boolean. Give it a shot and see if it works. Cheers!

    Oh and if you need to display something else in the combo box for the user's sake ("Yes" or "No" for instance) have a look at the bound column.
    Me.Geek = True

  3. #3
    Join Date
    May 2005
    Posts
    1,191
    By the way, here's a good Tip page by Allen Brown on Access Data types if you're interested.
    Me.Geek = True

  4. #4
    Join Date
    Feb 2008
    Posts
    27
    Thanks! It was the true or false that was giving me the issue.

Posting Permissions

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