Results 1 to 4 of 4
  1. #1
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919

    Can't set filter of an updateble recordset

    I have a form whose RecordSource is a simple query based on a table. I also have a combo box whereby the user can select a subset of the RecordSource for selective processing. I get the following runtime error when the code attempts to set the filter:



    Click image for larger version. 

Name:	e1.jpg 
Views:	13 
Size:	18.9 KB 
ID:	23722

    The sub where the combo selection is examined and the error occurs:

    Click image for larger version. 

Name:	e2.jpg 
Views:	13 
Size:	48.1 KB 
ID:	23723

    Why would this action be restricted?

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    Select = true
    is not a query nor filter.
    put actual queries in that column,not SQL.

  3. #3
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    OK, question time.

    Does column 2 of the control Me.cboEMAFilters really have the text string "Select = True"? Or just "True"?
    You do know that "Select" is a reserved work in Access/SQL? (I usually use "Selected")

    If you change (hardcode)
    Code:
    Me.Filter = "Select = True"
    and execute the code, is the form filtered?
    Maybe add brackets
    Code:
    Me.Filter = "[Select] = True"

  4. #4
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919
    Ah yes, "Select" needed to be in brackets. And, I'm with both you and Ranman256. The Recordsource table is 10 or 12 years old and I'm in a position to change the field name to "Selected" without blowing old apps "out of the water".

    Thanks to you both,
    Bill

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

Similar Threads

  1. Replies: 4
    Last Post: 05-20-2014, 12:45 PM
  2. Replies: 6
    Last Post: 12-03-2013, 11:14 PM
  3. Replies: 2
    Last Post: 10-25-2012, 02:53 AM
  4. Replies: 2
    Last Post: 03-08-2012, 12:59 PM
  5. Filter recordset
    By jgelpi16 in forum Programming
    Replies: 2
    Last Post: 01-26-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