Results 1 to 5 of 5
  1. #1
    mlrucci is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Apr 2018
    Posts
    202

    vba for click on list and go to record on same form

    I am attempting to write code on double click: go to the record in the same from the selected list lst.column(0) in VBA. I have written it in the macro within access, but cannot add additional code after that. I need to requery a list in the child form based on the information from the parent form. I keep banging my head on the wall.


    Attempted
    Docmd.SearchForRecord but the table has to be open..I even wrote to open the table run docmd.SearchForRecord and close table, but no go.
    Docmd.GoToRecord

    Putting the code for the refresh works by placing it in vba on the even on lost focus, but I do not like that fact that they have to click somewhere else for the list to update.


    Issues issues issues issues issues issues! Anyone have an idea?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,822
    Are main form and subform related - are Master/Child Links properties set?

    Not really understanding what you want.

    Why would table have to be open just to requery a form or a listbox? Why can't you add code? What happens - error message, wrong result, nothing?
    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.

  3. #3
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 11 Office 365
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,643
    Are you talking about .FindFirst?

    Code:
    Dim rs As DAO.Recordset
    
    Set rs = Me.Recordset
    
        rs.FindFirst "SomeID = " & Me.List0
    
        If Not rs.NoMatch Then
            Me.Bookmark = rs.Bookmark
        End If
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  4. #4
    mlrucci is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Apr 2018
    Posts
    202
    Moke123, You are a lifesaver. I am not one to jump on and as for help unless I have really tried. I mean hours! I am fairly new at vba code and am self-taught. You did this in the matter of minutes. You are the bomb!! Again, Thank you

  5. #5
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 11 Office 365
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,643
    Your welcome. Good luck with your project.
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

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

Similar Threads

  1. Replies: 3
    Last Post: 09-21-2019, 05:16 PM
  2. Replies: 5
    Last Post: 08-06-2018, 05:31 PM
  3. double click on a list to open record
    By mlrucci in forum Forms
    Replies: 3
    Last Post: 07-29-2018, 07:41 PM
  4. Replies: 8
    Last Post: 02-04-2016, 05:10 PM
  5. Replies: 8
    Last Post: 05-16-2014, 01:21 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