Results 1 to 8 of 8
  1. #1
    Deisun is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2011
    Posts
    14

    Go to selected record on a list stops working after...

    I need help getting a list to go to selected record.

    I have it working with this code, BUT...



    Code:
    Sub SearchResults_AfterUpdate()
        Dim rs As DAO.Recordset
    
        If Not IsNull(Me.SearchResults) Then
            'Save before move.
            If Me.Dirty Then
                Me.Dirty = False
            End If
            'Search in the clone set.
            Set rs = Me.RecordsetClone
            rs.FindFirst "[ID] = " & Me.SearchResults
            If rs.NoMatch Then
                MsgBox "Not found: filtered?"
            Else
                'Display the found record in the form.
                Me.Bookmark = rs.Bookmark
            End If
            Set rs = Nothing
        End If
    End Sub
    Works great but I have a second form (called Advanced Search) that is a more thorough search and when users click a search result there it comes back to my main form (with the quick search list described above). Once that happens though, the list in my form seems to not go to records when clicked.

    The Advanced Search form just has a box that overlays on top of every search result with a Open form and Selected result macro that reads:

    Clients, Form, , ="[ID]=" & [ID], , Normal


    So just to recap:
    2 different Forms: 1) Clients Form. 2) Advanced Search

    1) Clients Form has a list of all clients that can be selected and it will go to the record (displayed on the same form)

    Selecting from the list works perfectly BEFORE using the link from the Advanced search.

    2) Advanced search has a button for each result with that macro described above.

    The list on the Clients form stops working when I come from this Advanced Search Form via that button.

    Any help is greatly appreciated guys, been stumped on this one for like 4 hours now.
    I thought maybe setting me.filter = "" for the Clients Form On load would fix it but no luck.

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    can you post a sample database with garbage data? it's likely that something you're doing with your advanced search is screwing with the functionality of your clients form and I'd rather not have to recreate it to test for the error.

  3. #3
    Deisun is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2011
    Posts
    14
    Sure. Here is a sample of my DB:

  4. #4
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Ok I can't seem to replicate your error, walk me through exactly what you are doing and exactly what you are clicking to make the form 'not work'. And if it's just flat out not doing what you want it to rather than a specific error tell me what it is supposed to do.

  5. #5
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    oh wait, I think I see, you get a pop up that say

    not found: filtered?

    You likely need to not only reset your filter

    me.filter = ""
    me.filteron = false

    this is why I don't use filters

    I just added a button on the main form with those two lines of code, then when I was able to get that error to pop up I clicked that button and I was able to navigate the list box again.

  6. #6
    Deisun is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2011
    Posts
    14
    Hrm, making a button and throwing those lines in there didn't work for me.

  7. #7
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    it depends on your process. Put it anywhere where there's a termination of viewing a filtered item from your advanced search form. likely you could simply use the ON CLICK event of your list box to clear the filter and turn it off.

  8. #8
    Deisun is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2011
    Posts
    14
    Thank you very much rpeare - I've got it working perfectly now thanks to your help. +rep to you

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

Similar Threads

  1. Replies: 4
    Last Post: 06-16-2011, 09:30 PM
  2. Replies: 5
    Last Post: 04-04-2011, 09:57 AM
  3. "And" stops functions from working
    By JimmD43 in forum Programming
    Replies: 5
    Last Post: 03-19-2011, 11:10 AM
  4. Multi-record additions using a list box not working right
    By avarusbrightfyre in forum Programming
    Replies: 3
    Last Post: 10-27-2010, 01:50 PM
  5. Having - Like stops working
    By tdalber in forum Queries
    Replies: 0
    Last Post: 02-03-2009, 04:30 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