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

    DblClk to open form

    Hi all,


    I have a form field that has a dblclk to open a form for editing. Currently it open form and shows all records and what I am asking is there a way to get this to open the form to just specific businessID?

    Code:
    Private Sub CboReference_DblClick(Cancel As Integer)
        Dim LinkCriteria As String
            LinkCriteria = "[ReferenceName] = '" & Me!CboReference.Text & "'"
        DoCmd.OpenForm "frmReference", , , , , , Me.CboReference
        
    End Sub
    Something like DoCmd.OpenForm "frmReference" Where BusinessID = BusinessID so that when that form opens up to edit i only see the References from that business

    Thanks
    Dave

  2. #2
    d9pierce1 is offline Expert
    Windows 10 Access 2016
    Join Date
    Jan 2012
    Location
    Oklahoma
    Posts
    776
    Update,
    I was able to do this task by creating a query although still interested if this can be done by code in the dblclk function?

  3. #3
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    you've created your link criteria but haven't used it in your where parameter

    you just need to extend it to include businessID

    LinkCriteria = "[ReferenceName] = '" & Me.CboReference & "' AND [BusinessID]=" & me.businessID


    note better to use . than ! so you can get the benefit of autocomplete. Plus using ! late binds the value so it won't create an error on compilation (if there is one) but will on run. And you don't need to use the .text property

  4. #4
    d9pierce1 is offline Expert
    Windows 10 Access 2016
    Join Date
    Jan 2012
    Location
    Oklahoma
    Posts
    776
    thank you so much

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

Similar Threads

  1. Replies: 1
    Last Post: 03-02-2014, 01:31 PM
  2. Replies: 2
    Last Post: 08-07-2013, 07:44 AM
  3. Help on report to open form to open query...
    By saseymour in forum Programming
    Replies: 13
    Last Post: 07-16-2013, 08:11 AM
  4. Replies: 1
    Last Post: 05-03-2012, 02:25 PM
  5. Replies: 2
    Last Post: 02-26-2010, 08:14 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