Results 1 to 6 of 6
  1. #1
    caniread is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2015
    Posts
    86

    New Form problem after not filtering

    I have a form and subform with a one to many relationship. I am using the code below to go to a specific record but after using this code the subform does not show any entries for the many part of the relationship. Does someone know why this is? Used to work before I made this change.

    Code:
    Dim rs As Object
    Dim lngBookmark As Long
    'set a variable to the current record
    lngBookmark = Me.PARTS_ID
    'open the new form
    DoCmd.OpenForm "FRM_DETAIL_EDIT"
    
    
    'take it to the selected record
    Set rs = Forms!FRM_DETAIL_EDIT.RecordsetClone
    rs.FindFirst "PARTS_ID = " & lngBookmark
    
    
    'the lines marked as optional can be included if there's a chance the record won't exist in the form being opened
    
    
      Forms!FRM_DETAIL_EDIT.Bookmark = rs.Bookmark
    
    
    Set rs = Nothing


  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    That looks familiar.

    Are the master/child link properties of the subform control set appropriately? Or do you set the subform's source manually?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    caniread is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2015
    Posts
    86
    Everything looks good and I did not change it and it was working correctly before the new code I put in.

  4. #4
    caniread is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2015
    Posts
    86
    What I see happening is that the query has all the data showing up but for some reason, the form only shows new entry only. Been look everywhere but do not see why.

  5. #5
    caniread is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2015
    Posts
    86
    When I open up the form filtered using this code and then I unfilter it the data shows up. Does that give anyone an idea of what is going on?

    Code:
    DoCmd.OpenForm "FRM_DETAIL_EDIT", , , "PARTS_ID = " & Me.PARTS_ID

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Can you attach the db here? That code opens the form filtered, the subform should stay in sync if the master/child links are set appropriately.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Query Filtering Problem
    By David Reading in forum Queries
    Replies: 7
    Last Post: 09-19-2017, 11:03 AM
  2. Problem Filtering table in a sub-form
    By Xarkath in forum Access
    Replies: 6
    Last Post: 09-17-2014, 02:42 PM
  3. Replies: 14
    Last Post: 03-07-2012, 03:46 AM
  4. Date Filtering problem
    By TubbyGrey in forum Access
    Replies: 6
    Last Post: 10-22-2010, 10:46 PM
  5. Problem filtering a report
    By mrk68 in forum Reports
    Replies: 1
    Last Post: 05-03-2009, 09:31 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