Results 1 to 3 of 3
  1. #1
    wnicole is offline Competent Performer
    Windows XP Access 2010 32bit
    Join Date
    Sep 2013
    Posts
    118

    toggle filter after =[Code] = [Code] where condition

    I have a form with a button that opens another form based on WHERE condition. The [Project Code] links the form.


    However once it opens the form, then the user is stuck only on that form.
    In order to see the other project they then have to hit toggle filter button.

    In the macro (Access 2007) is there something I can add to make sure after you get to the other form, the user can still < > back in forth to other projects.
    Currently it only show 1 of 1 in record selectors.
    Can you help?

  2. #2
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    If you want yo try VBA:

    http://www.baldyweb.com/Bookmark.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    wnicole is offline Competent Performer
    Windows XP Access 2010 32bit
    Join Date
    Sep 2013
    Posts
    118
    Thanks so much I tried this code below but I think I'm missing something.

    I named the Code field "textMMMMCode" for both forms so I can link the two.
    However, when I hit the button it goes to the correct form, but the txtSubCode is not the correct one.
    The parent Projects match, but the sub Projects seem to be starting from beginning as if there is no connection.

    What I'm hoping to do:
    1. if there are no subprojects that it just goes to the sub form starting at first record.
    2. If there is subprojects it goes to the starting parent and the connecting ID for that parent is also linked. (Currently its not).

    Private Sub Command320_Click()
    Dim rs As Object
    Dim lngBookmark As String


    'set a variable to the current record
    lngBookmark = Me.TextMMMMCode
    'open the new form
    DoCmd.OpenForm "F_SubProjectMgmt"

    'take it to the selected record
    Set rs = Forms!F_SubProjectMgmt.RecordsetClone
    rs.FindFirst "[MMMM Code]" = " & lngBookmark"
    'the lines marked as optional can be included if there's a chance the record won't exist in the form being opened
    If rs.NoMatch Then 'optional - if no match, go to a new record
    DoCmd.GoToRecord acForm, "F_SubProjectMgmt" 'optional
    MsgBox "There are no Subprojects for " & [MMMM Code], vbOKOnly, " 'optional - copy the employee ID from this form"
    Forms!F_SubProjectMgmt.TextMMMMCode = Me.TextMMMMCode 'optional - copy the employee ID from this form


    Else 'optional
    Forms!F_SubProjectMgmt.Bookmark = rs.Bookmark
    End If 'optional

    Set rs = Nothing
    End Sub

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

Similar Threads

  1. Multiple Form Filter Criteria vba code
    By Moonman in forum Programming
    Replies: 6
    Last Post: 11-16-2013, 12:42 AM
  2. VBA code multiple export to xml with filter
    By Bertrand82 in forum Programming
    Replies: 9
    Last Post: 01-15-2013, 03:55 AM
  3. VBA Code to Filter a Report from a Subform
    By jesterII in forum Access
    Replies: 8
    Last Post: 05-02-2012, 01:23 PM
  4. How to filter dates using an apply filter code.
    By Jgreenfield in forum Reports
    Replies: 4
    Last Post: 11-15-2011, 01:38 PM
  5. Filter Code
    By botts121 in forum Programming
    Replies: 0
    Last Post: 09-03-2009, 01:59 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