Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727

    load blank subform


    All, using 2010. I have a search form(unbound) with 4 unbound txt boxes to filter a subform. When I load the form; It loads all the records. I don’t want this. How can I load with no records showing. Also; I have a clear button that clears the txt boxes to start another search. But when I clear; the last search record remains. I want to reset it back to not records. I tried removing the recordsource and or the sourceobject and I get errors or #name?. In addition; I have other subforms linked to the main subform and they all clear when clicking the clear button. Pls help.

  2. #2
    hapm is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2014
    Posts
    197
    Set the filter to False will filter all records.

  3. #3
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727
    I set the filter in the property of subform to false then tried true; both ways didn’t clear the form. Does the cycle do anything?

  4. #4
    hapm is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2014
    Posts
    197
    Did you set it to "False" or to False? perhaps try something like True = False

  5. #5
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727
    not working??

  6. #6
    hapm is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2014
    Posts
    197
    Then add a filter that checks the id field to be 0 or better NULL: ID IS NULL
    This always work, but be sure to set FilterOnLoad to true as well

  7. #7
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727
    Ok on the filter on load to true but do I create an event procedure? How??

  8. #8
    hapm is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2014
    Posts
    197
    Its a property of your form and should work without any event procedure.

  9. #9
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727
    Great it worked! One thing; would it be too much to ask how do I make the filtered records unload on clear the unbound text boxes??

  10. #10
    hapm is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2014
    Posts
    197
    Simply set the filter back to ID IS NULL when clearing the textboxes

  11. #11
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727
    This is not working when trying to clear the subform.

  12. #12
    hapm is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2014
    Posts
    197
    Show the code please.

  13. #13
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727
    Code:
     Dim ctl As Control
       Dim txtBx As TextBox
       For Each ctl In Me.Controls
          If ctl.ControlType = acTextBox Then
             Set txtBx = ctl
             If txtBx.Tag = "clr" Then
                txtBx.Value = Null
          End If
          End If
       Next ctl[Forms]![frmCustSrch]![sfrmCustSrch].[Form]![Cust_id]= Null
    It clears everything but the subform.

  14. #14
    hapm is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2014
    Posts
    197
    Well, you don't set the sub forms filter anywhere do you?

  15. #15
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727
    Sorry, I don't know what you mean. The subform remains populated with the last filter

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 05-20-2014, 09:32 AM
  2. blocking blank spaces on a subform
    By Paintballlovr in forum Forms
    Replies: 5
    Last Post: 12-06-2013, 05:22 PM
  3. Replies: 6
    Last Post: 08-24-2012, 12:04 PM
  4. Replies: 5
    Last Post: 06-11-2012, 08:47 AM
  5. Replies: 4
    Last Post: 03-14-2012, 10:08 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