Results 1 to 4 of 4
  1. #1
    d9pierce1 is offline Expert
    Windows 10 Access 2016
    Join Date
    Jan 2012
    Location
    Oklahoma
    Posts
    776

    Open form to specific record without filtering the open form?

    Is it possible to open a form with a cmdbtn to a specific record without filtering the form that you open?
    Code:
    Private Sub CmdAccountDetails_Click()
      DoCmd.OpenForm "frmAccountDetail", , , "[AccountID]=" & Me.AccountID
      DoCmd.Close acForm, "frmAccount"
    End Sub
    Thanks
    Dave

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Would have go to record. One method uses bookmarks. Review Form.Bookmark property (Access) | Microsoft Docs

    Use OpenArgs to pass the AccountID to form. Then in its Open event:

    If Not IsNull(Me.OpenArgs) Then
    'code to go to record
    End If

    Instead, could use form/subform arrangement.
    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
    d9pierce1 is offline Expert
    Windows 10 Access 2016
    Join Date
    Jan 2012
    Location
    Oklahoma
    Posts
    776
    thank you June7,
    I will give that a shot
    Dave

  4. #4
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    An alternative I used to use a few years ago, should still work:

    Code:
    Private Sub CustomerID_DblClick(Cancel As Integer)
    
    
    Dim CurrentCustomer as Long
    
    
    Me.Dirty=False
    DoCmd.Echo False
    CurrentCustomer = Me.CustomerID 
    DoCmd.OpenForm "frmCustomer"      
    Screen.ActiveForm![CustID].SetFocus  'control holding the ID you want to load
    DoCmd.FindRecord CurrentCustomer
    DoCmd.Echo True
    
    
    End Sub
    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

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

Similar Threads

  1. Open form with specific record
    By Lukael in forum Programming
    Replies: 14
    Last Post: 11-16-2015, 06:31 AM
  2. Open form to specific record
    By zoro.1983 in forum Access
    Replies: 3
    Last Post: 05-31-2015, 11:04 AM
  3. Open form on specific record
    By iky123 in forum Forms
    Replies: 1
    Last Post: 04-11-2012, 09:56 AM
  4. Open form to specific record
    By Two Gun in forum Forms
    Replies: 7
    Last Post: 11-09-2011, 10:00 AM
  5. Open Form to Specific Record
    By batowl in forum Forms
    Replies: 1
    Last Post: 04-08-2011, 10:10 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