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

    Error referencing filter property of a sub-form container

    I have a form where the code-sheet sets a filter for the RecordSource of a sub-form. Below is a screen-shot of the code when debug is entered. I hovered over the variable that contains the filter expression. (cmboRetreats_Click() is called by the OnOpen event code, as opposed to a click action.)



    Click image for larger version. 

Name:	SS-Code.png 
Views:	7 
Size:	39.0 KB 
ID:	15866

    And, a screen-shot of the error:

    Click image for larger version. 

Name:	SS-Error.png 
Views:	7 
Size:	7.0 KB 
ID:	15867

    The error DOES NOT suggest a problem with the sub-form's RecordSource query, which I ran directly without errors.

    The offending statement: "Me.TransAcctSubform.Form.Filter = SubFrmFilter" is making reference to the sub-form's container control, "TransAcctSubform". I'm clueless at this point what is giving rise to the error.

    Any ideas?

    Thanks,
    Bill

  2. #2
    Xipooo's Avatar
    Xipooo is offline Sr. Database Developer
    Windows 8 Access 2013
    Join Date
    Jan 2014
    Location
    Arizona
    Posts
    332
    Try moving your function call to the "On Load" event.

    A recordset is not bound to the form yet during the On Open event. It is during the loading of the form that the recordset gets bound.

  3. #3
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919
    The error goes away, but only the parent form's header displays. I.e., the parent form's Detail section displays empty.

  4. #4
    Xipooo's Avatar
    Xipooo is offline Sr. Database Developer
    Windows 8 Access 2013
    Join Date
    Jan 2014
    Location
    Arizona
    Posts
    332
    It must be because your filter string is causing 0 records to be displayed. Evaluate what the filter requirements are and whether or not your recordset will have any records that match the criteria at the point where the form loads. It looks like your filter is based on what someone selects in the ComboBox. Since the user hasn't had a chance to select something yet, your combobox will likely have a "Null" value. So your filter is looking for recordsets that have a "Null" for FolioID.

    Do you have a default value for your combobox?

  5. #5
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919
    I stumbled upon the problem. Even though this code has been running successfully for years with a different back-end mdb, it seems that the current back-end has "tickled" a problem that has existed since the app was written many years ago. Some how, the parent form had its RecordSource bound to the same query as the sub-form in question here. The parent ought not have ANY RecordSource at all, as all the data to be displayed is via the sub-form. Apparently, the duplication caused problems when the current back-end (new) only has one record in its RecordSource, namely that relating to the folio "FH-AccNo".

    Thanks for your thoughts,
    Bill

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

Similar Threads

  1. Filter property (missing operator syntax error)
    By Access_Novice in forum Programming
    Replies: 24
    Last Post: 01-28-2014, 09:17 PM
  2. Replies: 8
    Last Post: 10-29-2013, 04:42 PM
  3. Replies: 28
    Last Post: 03-08-2012, 06:47 PM
  4. Replies: 2
    Last Post: 04-13-2011, 09:42 AM
  5. Referencing split form data / filter
    By stephenaa5 in forum Programming
    Replies: 2
    Last Post: 09-14-2010, 08:48 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