Results 1 to 2 of 2
  1. #1
    VariableZ's Avatar
    VariableZ is offline Partially Knowledgeable
    Windows 7 64bit Access 2007
    Join Date
    May 2011
    Location
    Georgia, USA
    Posts
    40

    Difference Between Brackets And No Brackets In Filter?

    I have a button on Form1 that opens Form2, and there's a little VBA code to filter the form based on in user input on Form1. And it works properly. Was bothers me is that if I go to Advanced Filter/Sort in the newly opened Form2, the fields have brackets around them, whereas if I filter directly on Form2, there are no brackets. I'm probably just being nitpicky, but is there any way to write the VBA filter string so that the fields don't have those brackets? I find them irksome.

  2. #2
    Dal Jeanis is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742

    Possible but inadviseable

    The brackets are absolutely required when the table names or control names or field names have internal spaces, optional otherwise. You can certainly translate the filter to eliminate the [] using string functions, if you're sure that you don't have internal spaces in any relevant names, and if you're sure that you want to. It would look something like this:
    Code:
       Me.Filter = Replace (Replace (Me.Filter, "]", ""), "[", "")
    Here's a page that lists all the string functions, (and the rest) http://www.techonthenet.com/access/functions/

    Please note that there are occasional situations where Access or Jet decides that the brackets are NOT optional, and I can't guarantee you won't run into one of those at any given time.

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

Similar Threads

  1. Date difference
    By Kaaivin in forum Queries
    Replies: 2
    Last Post: 07-03-2013, 06:06 AM
  2. Difference Query
    By kaushalneo in forum Queries
    Replies: 1
    Last Post: 05-20-2013, 01:49 PM
  3. Get difference of Min and Max
    By nazimscr in forum Queries
    Replies: 1
    Last Post: 07-14-2012, 02:04 PM
  4. Search for brackets
    By stocktsi in forum Access
    Replies: 3
    Last Post: 11-14-2011, 06:18 PM
  5. Time difference
    By jguidry in forum Programming
    Replies: 1
    Last Post: 11-15-2008, 12:41 PM

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