Results 1 to 9 of 9
  1. #1
    journeyman is offline Advanced Beginner
    Windows 11 Access 2016
    Join Date
    Dec 2022
    Posts
    82

    Error trapping filter on datasheet

    Hi all,

    My form contains a subform. The source object is a query. This allows me to offer a filter for the recordset, without needing to write one into a form.

    Whenever the user filters on this subform, however, Access considers this a design change. But it's not a design change. Its basic filter functionality.

    So when the user closes the main form the following msg presents.

    Code:
    Do you want to save changes to the design on query 'Qry_MyQuery'.
    The issue is that you can't trap this error and ignore it, because the source object is not a form.

    How do I trap this error - thus not presenting my users with this design question.

    Cheers

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Exactly how does user apply filter?
    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
    journeyman is offline Advanced Beginner
    Windows 11 Access 2016
    Join Date
    Dec 2022
    Posts
    82
    The user selects from the datasheet filter options.

    i.e. the dropdown button to the right side of the field title.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    I tested this with form bound to table and don't get that message.
    I don't understand your reason for using query but even with query I don't get message.
    Want to provide your db for analysis?
    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
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2013 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    Do you manipulate the subform properties (maybe its record source) in you main form VBA module? Maybe this older thread can help you:
    https://stackoverflow.com/questions/...-the-layout-of

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  6. #6
    journeyman is offline Advanced Beginner
    Windows 11 Access 2016
    Join Date
    Dec 2022
    Posts
    82
    Thanks for responses.

    June7
    As I mentioned the subform uses the query as the record source. The reason for this is to use the native filter feature of the query datasheet, which you can't do on a created form (you'd have to write one for the form)
    The subform source object is set with:
    Code:
    me.subfrm_child.sourceobject = "Query.qry_MyQuery"
    Various limitations prevent me from posting the database.

    Gigu
    Thanks for your link. I was hoping not to have to go to the effort of writing a class to capture a change to the subform datasheet.

    It's a stupid error because there is no change to the datasheet. It's a filter, triggering a design change in a compiled user form.

    Cheers

  7. #7
    davegri's Avatar
    davegri is offline Excess Access
    Windows 11 Access 2019
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,413
    My research shows that FILTER is a property of a query. If you use the dropdown to set a filter in a query's datasheet, it is indeed a pending design change.

    Click image for larger version. 

Name:	qfilterDrop_.png 
Views:	16 
Size:	21.0 KB 
ID:	50521

    If you respond to the design request positively, then open the query again, you will see

    Click image for larger version. 

Name:	qfilterProp.png 
Views:	15 
Size:	29.6 KB 
ID:	50522

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Okay, now I understand. Using query as SourceObject for a subform container control (not RecordSource of a form). Sorry, did not catch that in first post.

    Build a form bound to table or query and use form as SourceObject for container. Set form for datasheet view and you will have the same filter tools and no message.
    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.

  9. #9
    journeyman is offline Advanced Beginner
    Windows 11 Access 2016
    Join Date
    Dec 2022
    Posts
    82
    Quote Originally Posted by June7 View Post
    Okay, now I understand. Using query as SourceObject for a subform container control (not RecordSource of a form). Sorry, did not catch that in first post.

    Build a form bound to table or query and use form as SourceObject for container. Set form for datasheet view and you will have the same filter tools and no message.
    Okay, good idea. Thanks June, I'll give this a go.


    Also Davegri

    Thanks, I didn't know this. Now I do!

    Cheers


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

Similar Threads

  1. Error trapping ms access
    By niktsol1978 in forum Access
    Replies: 12
    Last Post: 11-23-2019, 01:56 AM
  2. Error trapping problem in subform
    By dgmdvm in forum Programming
    Replies: 9
    Last Post: 07-14-2019, 10:37 AM
  3. error trapping on a subform
    By dgmdvm in forum Forms
    Replies: 4
    Last Post: 08-24-2018, 02:52 PM
  4. Append query error trapping
    By tpcervelo in forum Programming
    Replies: 4
    Last Post: 12-22-2011, 10:57 AM
  5. Proper Error Trapping
    By SemiAuto40 in forum Programming
    Replies: 6
    Last Post: 08-11-2011, 10:22 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