Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Dec 2001
    Location
    Nevada, USA
    Posts
    207
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Me.filter Syntax - 2007 vs. 2003 (Access 2007)

    I recently bought a new machine -- Windows Vista Home Premium and Office 2007 Pro. I am attempting to do maintenance on a form that was developed years ago and runs properly under both Access 2000 and Access 2003. Here is the problem:

    I have fairly extensive code behind the form in question. There is one line as follows:

    test = Me.Filter (test is a string variable)

    I then go on to parse (using the InStr function) the variable test looking for "=" and ")". Under Access 2007, "=" was found but ")" was not. Under Access 2003, both "=" and ")" were found. I went into debug and found that, lo and behold, under Access 2007, test = [FirstOfFirstOfTicket Number] = 68271 but under Access 2003, test = ([FirstOfFirstOfTicket Number] = 68271). IOW, under Access 2003 there are parens surrounding the entire string but they are not present under Access 2007.

    Is this a documented change in Access 2007? This is a major issue for me as I have a lot of code that depends on the older syntax (the one with the parens) of Me.filter.

    Is there a way around this?

    Any help would be greatly appreciated.
    Carol W.

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

    Re: Me.filter Syntax - 2007 vs. 2003 (Access 2007)

    I can't find anything about this, but the SQL is valid both with and without the parentheses. You could test whether an opening parenthesis ( is present, and if so, look for the closing parenthesis ).

  3. #3
    3 Star Lounger
    Join Date
    Dec 2001
    Location
    Nevada, USA
    Posts
    207
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Me.filter Syntax - 2007 vs. 2003 (Access 2007)

    Thanks, Hans. I've run into these kinds of issues (code worked until new version of software came out, then code stopped working) many times in my career.

    I'll have to adjust the code. Is there a variable that will tell me under which version of Access the application is running?
    Carol W.

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

    Re: Me.filter Syntax - 2007 vs. 2003 (Access 2007)

    Application.Version returns a string:

    <table border=1><td>Version</td><td>Application.Version</td><td>Access 97</td><td align=center>8.0</td><td>Access 2000</td><td align=center>9.0</td><td>Access 2002 (XP)</td><td align=center>10.0</td><td>Access 2003</td><td align=center>11.0</td><td>Access 2007</td><td align=center>12.0</td></table>

  5. #5
    3 Star Lounger
    Join Date
    Dec 2001
    Location
    Nevada, USA
    Posts
    207
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Me.filter Syntax - 2007 vs. 2003 (Access 2007)

    Hans:

    Thanks for the quick reply.
    Carol W.

Posting Permissions

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