Results 1 to 7 of 7
  1. #1
    jsimard is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Feb 2011
    Posts
    28

    Where Condition length too long

    I am trying to create a macro that will allow a user to enter some "search text" into a text field, hit the search button and only get the results they are looking for. I want to search the entire database not just certain fields. The apply filter macro was working perfectly for me until I reached 255 characters. This will not allow me to search all the fields required. Is there a way to search the entire database. I do not want to use the find feature as that still displays all the other records.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,945
    By 'database' you mean a table?

    You want to search for the same parameter in all fields? Why? What is the table structure?

    Show example of filter criteria. Exactly how are you constructing this string?

    I don't use macros, only VBA.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    jsimard is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Feb 2011
    Posts
    28
    The database contains all medical products used in the organization. Table fields include contract #, vendor name, brand name, product description etc. I would like the user to be able to search by any of these fields. They may want to search for "syringe", by a certain vendor or vendor code. I want one text box that will search all of my fields and only display results pertaining to their search.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,945
    Still not sure how you are hitting 255 character limit.

    I have one combobox for selecting the field to search. Then another combobox that lists data from selected field. Then a button to initiate search/filter. All is managed with VBA code.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    jsimard is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Feb 2011
    Posts
    28
    I reach the maximum 255 characters in the Macro: Apply Filter:
    Where Condition = [Contract Desc] Like "*" & [Forms]![frmSearch]![Text99] & "*" Or [Vendor Name] Like "*" & [Forms]![frmSearch]![Text99] & "*" Or [Brand Name] Like "*" & [Forms]![frmSearch]![Text99] & "*"

  6. #6
    Perceptus's Avatar
    Perceptus is offline Expert
    Windows 7 64bit Access 2007
    Join Date
    Nov 2012
    Location
    Knoxville, Tennessee
    Posts
    659
    you could change your where conditions to limit the amount of data your are checking for. like

    WhereCondition$ = [Contract Desc] Like "*" & mid([Forms]![frmSearch]![Text99],1,100) & "*" Or [Vendor Name] Like "*" & mid([Forms]![frmSearch]![Text99],1,50) & "*" Or [Brand Name] Like "*" & mid([Forms]![frmSearch]![Text99],1,100) & "*"


    Even this would hit the 255 character issue. as Len(WhereCondition$) is likely > 255 after evaluating.

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,945
    As noted, I would not use that methodology.

    So no need to search by date or some numeric data?

    If you don't want VBA, the only alternative I see is a dynamic parameterized query. Review http://datapigtechnologies.com/flash...tomfilter.html
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. How to Increase Memo Length
    By Mahendra1000 in forum Access
    Replies: 5
    Last Post: 09-24-2013, 09:56 AM
  2. Replies: 1
    Last Post: 09-16-2013, 04:35 PM
  3. Reading row length
    By dnlhmpt in forum Import/Export Data
    Replies: 2
    Last Post: 01-31-2012, 07:47 AM
  4. same length query
    By makatak88 in forum Queries
    Replies: 9
    Last Post: 10-20-2011, 07:03 AM
  5. Length of Stay
    By lhysell in forum Queries
    Replies: 1
    Last Post: 02-02-2011, 10:45 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