Results 1 to 8 of 8
  1. #1
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727

    filter

    Help. Trying to filter a subform from combo box on main form.
    Code:
    Private Sub cboSSN_AfterUpdate()
    
    Dim strFilter As String
    
        strFilter = "SSNum = '" & Me.cboSSN & "'"
    
    Forms!frmMedQ!sfrmMedCInfo.Form.Filter = strFilter
    Forms!frmMedQ!sfrmMedCInfo.Form.FilterOn = True
    End Sub
    Not working. Any suggestions? Thanks

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Why not use the LinkMaster/ChildFields properties of the SubFormControl? That's what they are for!

  3. #3
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727
    I am using the linkmaster/childfields?? They are linked by the SSNum. So I guess I am using the wrong code??

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    If the LinkMaster/ChildFields are set properly than no filter is necessary. What do you have as the value of these two properties of the SubFormControl?

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,633
    The main form is bound? What is the RecordSource? The subform holds child records related to records of main form? The Master/Child links of the subform container control will synchronize display of related child records. No code needed.
    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.

  6. #6
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727
    subform so that when the user select the SSN it will pull the related record in the subform. Sorry for all the confusion because I know I have worked this in event code “afterupdate” and it doesn’t seem to be working. I guess I have forgotten the steps to completing this. I’ve tried this code and it seems not to work either:
    Code:
    Dim rs As Object
        Set rs = Me.Recordset.Clone
        rs.FindFirst "[SSNum] = '" & Me.cboSSN & "'"
        If Not rs.EOF Then Me.Bookmark = rs.Bookmark
    I really appreciate your help.

  7. #7
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727
    All; I got it. Must be a new day and new brain thanks for all your help!

  8. #8
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Are you going to use the Thread Tools at the top of the thread and mark this thread as solved?

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

Similar Threads

  1. Filter By Form and Apply Filter Buttons
    By JustLearning in forum Forms
    Replies: 13
    Last Post: 02-18-2015, 01:01 PM
  2. Replies: 5
    Last Post: 02-07-2013, 12:21 PM
  3. Replies: 1
    Last Post: 08-16-2012, 01:51 PM
  4. Apply Filter similar to Field Filter
    By DatabaseIntern in forum Forms
    Replies: 1
    Last Post: 06-11-2012, 05:42 PM
  5. Replies: 28
    Last Post: 03-08-2012, 06:47 PM

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