Results 1 to 4 of 4
  1. #1
    JeRz is offline Advanced Beginner
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2014
    Posts
    33

    Using Like with a combo box on search form

    Hi All,



    I have a search form that I am attempting to add a combo box to. All other fields are text fields with the exception of this field as the bound column is the Autonumber.

    How do you use Like in this scenario to locate records when it is an Integer?

    I currently have Like "*" & Forms!Search!cboissuetypesrch & "*" in my query criteria

    Thanks!

  2. #2
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,016
    I may be wrong, but I'm pretty sure that you cannot use the Like operator with numbers. Only possible approach I can think of, and I don't have time to test this out, right now, would be to use CStr() to force your Autonumber field into a string.

    I have to say, though, that end users searching directly on an Autonumber is quite strange...this should only be done by Access itself! Autonumbers have one purpose, and one purpose only...to provide a unique identifier for a given Record, and should be used for no other purpose...end users should not even be aware that they exist!

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  3. #3
    JeRz is offline Advanced Beginner
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2014
    Posts
    33
    Quote Originally Posted by Missinglinq View Post
    I may be wrong, but I'm pretty sure that you cannot use the Like operator with numbers. Only possible approach I can think of, and I don't have time to test this out, right now, would be to use CStr() to force your Autonumber field into a string.

    I have to say, though, that end users searching directly on an Autonumber is quite strange...this should only be done by Access itself! Autonumbers have one purpose, and one purpose only...to provide a unique identifier for a given Record, and should be used for no other purpose...end users should not even be aware that they exist!

    Linq ;0)>
    Thanks for the response! I changed the row source as to not search on the Autonumber and it works. Thanks again!

  4. #4
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,016
    Glad we could help!

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

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

Similar Threads

  1. Replies: 5
    Last Post: 09-22-2016, 08:42 AM
  2. Search Combo Box on Form
    By Rhubie in forum Forms
    Replies: 15
    Last Post: 03-15-2013, 02:40 PM
  3. Replies: 7
    Last Post: 08-08-2012, 03:28 PM
  4. Replies: 1
    Last Post: 04-20-2012, 03:16 AM
  5. Combo Search Form
    By Filmnoir in forum Forms
    Replies: 26
    Last Post: 01-26-2012, 10:12 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