Double click on a listbox to open record Results

Hi there

I have a form that I have set up containing 2 pages (tabs) that cover the whole form.
When the form loads it opens pgeBookingDetails. PgeStart contains a listbox that is sourced by a query.

What I am trying to do is double click on the selected record within in the listbox and have code open up the 2nd page and display the records details.

The listbox has 5 columns. The 1st column displays tje primary key from the query(this is what I wish to use as a reference)

How can I have a double click event open the 2nd page and goto to my wanted record.

This is the code I have tried but it doesn't work.

	Private Sub lstBookings_DblClick(Cancel As Integer)

Dim result As String
DoCmd.GoToControl ("pgeBookingDetails")
result = Me.lstBookings.Column(0)
DoCmd.GoToRecord , , acGoTo, result
End Sub

Does anyone have any suggestions?

I have currently created a few search fields where the results appear in a listbox. What I am hoping to do is to double click on a specific record in the listbox and have it open up to a form with all the details in it. Currently my code for the listbox is:

Private Sub lstMSDNInfo_DblClick(Cancel As Integer)
'Open frmMSDN based on the ID from lstMSDNInfo listbox

DoCmd.OpenForm "frmMSDN", , , "ID = " & Me!lstMSDNInfo, , acDialog

End Sub

When I run it, it just gives me a syntax error The OpenForm action was cancelled. When i debug it it takes me to:

DoCmd.OpenForm "frmMSDN", , , "ID = " & Me!lstMSDNInfo, , acDialog

Any ideas of what I am doing wrong? I know it's something really simple that I'm missing but I've been over it several hundred times and I can't find anything wrong with it. Any help would be greatly appreciated


Hey there.
I have a search form where users can search for workers. The results are displayed in a listbox. From there, the user can double click on a name to open that worker's record. What I would like to happen is if there is only 1 result (a perfect match) I would like the worker's record to automatically open up. Here is my code:

	Private Sub cmdSearch_Click()

 If Me.lboResults.ListCount = 1 Then
 DoCmd.OpenForm "frmWorkers", acNormal, , "[vID] = " & Me.lboResults
 End If
End Sub

The problem I'm having is it can't open the form because that record is not actually selected in the listbox. How would I go about automatically making the selection to the 1 record in the listbox?



I'm having trouble finding the correct code to open a network folder by double clicking on a record in a listbox on a form.

The folder names are the record IDs. Any help is appreciated.

The code I have been messing with is:

Application.FollowHyperlink "Storehouse1AdminClientLibrary2009& Me![lstbxClients]![RecordID]"

I have a form with an unbound listbox (InquiriesList), the listbox is getting
its data from a query. I want the user to double click on an item in the list
and have the Inquiry Information to populate automatically the other controls on my form based on the specific record
from the listbox.
The criteria that it should be looking up is "InquiryID" (Primary Key) . The listbox has 3 columns the first is the InquiryID.
I have found information on double clicking an item from the list box and opening a second form, but I need this functionality within one form.
I can provide more detail information if needed

Any help would be greatly appreciated.

I know this is a topic that has been covered on this site, but I am unable to find anything that works for me, as all the answers are a little bit more experienced than I am.....

I have a database of patients. Very simply, I wish to create a form with a list box on it. The user then starts typing a patients name, or scrolls and selects it from the listbox, and then either double clicks the name/clicks a separate button which opens that specific record in an entry form... make sense??

So, the forms I have are:

'Client Information Form' - the main entry form, based on 'Client Information' Table
'Index Query' - a query with just the patients name and is linked to the 'Client Information' table via 'Client ID'

I'm doing this free for a hospital, and can't really afford to pay for professional help, so I though I would ask here.

Many thanks, any adivce would be great


I want to be able to double click on a record in a listbox (lstSubOrder) which uses (qrySubOrder), which in turn will open the orders form with the CustomerID, Title, FirstName and Lastname from the listbox copied into the corresponding fields on the orders form (tblOrders). I can do this with just fields from one table to another, but i dont know how to do it with fields from a listbox to a table.

The normal way if it was just fields from table to table for CustomerID would be;

Forms![frmOrders]!CustomerID.Value = Me![CustomerID].Value

Any ideas on how to do it, i've had a go and i cant figure it out.

I currently have a listbox with multiple records that are listed as "Select Distinct". I would like to enable a double click event on a particular Distinct record in the listbox and open a second form which displays all the records that are combined in the "Select Distinct" record. To complicate matters these records have a concatenated primary key ( 4 fields equip_init, equip_nbr, repair_dt, repair_order_nbr)

Any help would be greatly appreciated.




Apologies if this has been answered before I did try searching and implementing/amending some other solutions - but probably down to my own level of expertise could not get working.

The problem I have is;

I have a form with a Listbox63 within the Listbox are the fields surname and firstname. I would like the end-user to be able to double click on one of the rows and it opens a form called "Personal Details" at goto the record selected so that the user can edit this entry in the form.

I would appreciate any help anyone can offer.



I have a form that is unbound. Information is entered into the form which populates a subfrom via a query and when the Save button is clicked an append query is ran to add the records to the final table.

I have a listbox on another form that displays all the records in the table. I need to be able to double click on a record in the listbox and open up the unbound form with the selected record for editing.

Is this possible?


Hi there,

I have a series of forms for users to enter data about isolated patients. The first form in the series contains a listbox linked to a query that displays all of the patients that are currently present and under isolation at the hospital. I have two tables with a parent-child relationship. The parent table contains info about the patient (tblPatient), and the child table (tblCase) contains info about the specific visit.

I would like users to be able to double click on a specific record and have that event bring them to a form that allows them to specify an enddate and edit certain aspects of the record. I think this needs to be a form with a subform in it.

I have looked online and in this forum and I cannot get the dbl click code to bring up the relevant records. I have seen examples of how to do this, but I can't wrap my head around how to code it.




I have a form called "Contacts" with two tabs. On the second tab, it has one subform "Call Listing Subform"

In a different location I generate a listbox to help find the different customer calls. This listbox works well and it shows me the results I need.

Here is what I am unable to do. I am trying to open the main form "Contacts", showing the 2nd tab, and with the cursor on the Call that was clicked on. I do not need to hide other calls...I just need the cursor on the line where the selected call is.

This is the code to fill out the listbox

	Private Sub txtsearch_AfterUpdate()
    If Me.txtsearch.Value  "" Then
        Me.lstsearch.RowSource = "Select [ContactID], [SubCallID], [CallID], [SubCallDate], [SKU], [WhoPickedUp],
[IssueType], [StatusAfterCall], [ResolutionDetails], [CustomerID] " & _
                        "From [EmployeeSearch] " & _
                        "Where [CustomerID] like '*" & Me.txtsearch & "*'"
        cmbTimeFrame.Value = ""
        Me.txtcount = Me.lstsearch.ListCount
        Exit Sub
    End If
    Me.lstsearch.RowSource = ""
End Sub

The CallID is what defines that call that I want to show.

Problem is...Using the following code on a double click, all I get is for the "Contacts" form to open in the 1st tab, I have to manually click on the 2nd tab and then find the call:

	Private Sub lstsearch_DblClick(Cancel As Integer)
    Dim stDocName As String
    Dim stLinkCriteria As String
    stDocName = "Contacts"
    stLinkCriteria = "[ContactID]=" & Me![lstsearch]
    DoCmd.OpenForm stDocName, , , stLinkCriteria
End Sub

The following is a modification if this code, but it only opens the subform, not the "contacts" form showing the 2nd tab:

	Private Sub lstsearch_DblClick(Cancel As Integer)
    Dim stDocName As String
    Dim stLinkCriteria As String
    stDocName = "SubCalls"
    stLinkCriteria = "[SubCallID]=" & Me![lstsearch]
    DoCmd.OpenForm stDocName, , , stLinkCriteria
End Sub

Can what I am asking for be done?



How to add second criteria to OpenForm function?
Basically, I need help with double click VBA code event in a ListBox.
I two related forms, in the primary form contain a listbox, when user double click on a specific record, the second form will open and should filter record based on 2 criteria (LoanInfoID and RequestDate).

Private Sub RequestList_DblClick(Cancel As Integer)
DoCmd.OpenForm "F_LoanDocuments", , , "LoanInfoID=" & LoanInfoID AND SECOND CRITERIA IN LIST BOX(RequestDate)
DoCmd.GoToRecord , , acNewRec
End Sub

ListBox Row Source:
SELECT T_Request.LoanInfoID, T_Request.RequestDate, T_TransactionType.TransactionType
FROM T_Request INNER JOIN T_TransactionType ON T_Request.TransactionTypeID = T_TransactionType.TransactionTypeID
GROUP BY T_Request.LoanInfoID, T_Request.RequestDate, T_TransactionType.TransactionType
ORDER BY T_Request.RequestDate;

Thank you in advance

I have built an access db and I have a form with a list box on it that lists all my customers.

Cust Id, Last Name, First Name etc

I can scroll down the list and when I double click on the particular customer it will open up another form with their details on it which is what I want.

As I have so many customer records what I'd like to have is a text box at the top of the form that will filter the list by surname, ie if i type 'Jones' only the customers with that surname appear in my list box. I can then double click the record to view their details like I'm already doing.

Anyone got any ideas?


I have a listbox.. which has a source of a Union Query Joining multiple tables together. This works fine.. The tables are ExpBooking / ExpMoveOrder & ExpDockReceipt.

When i create one of those on their form the listbox will show them created line after line. Sometimes you have multiple dock receipts & multiple move orders. Everything is working fine here... For example I will say my listbox contains the below..


When you double click on any of the above it opens the coorsponding form with that information (opened by shared key ).

Here is the problem... When i open move order form & i click the DELETE button ( which can happen.. sometimes i have to remove moveorders) it does in fact delete the record from the table ExpMoveOrder. It then Requeries the Listbox to now reflect the correct Information ( deleting move order)

Dock Receipt

Upon clicking of this delete button while it does delete this record it seems to be moving to the next listbox item (Dock Receipt) & it forces that form OPEN. I cant seem to figure it out. Ive tried setting focus elsewhere etc. The only thing that works is taking out the Requery for the listbox.. But then it still shows that move order we already deleted... Any advise would be helpful.. I tried GoToRecord First Last Previous.

Using 2010 & a VBA newbie

I have a form set up as a directory using a listbox of contact names and email address. I have set it up so that when I double click on a contact name, a form opens with just that contact's record for editing. I'd like to add a button to this form, so that when clicked it would open an email for the contact currently selected in the list. Best way to accomplish this?


This is something i have done many times before, but today for some reason it wont work.

I have a search form with a list box which shows the results.

i have this code on the double click event:

  Dim stDocName As String
   Dim stLinkCriteria As String
   stDocName = "frmAllContactsSummary"
   stLinkCriteria = "[ContactID]=" & Me![SearchResults]
   DoCmd.OpenForm stDocName, , , stLinkCriteria

frmAllContactsSummary opens with a filter applied, however it opens at a new record, not the one where ContactID=SearchResults.

I have checked the bound column in the list box, which is 1 (which is the correct field for ContactID) and when I go to design view on frmAllContactsSummary the filter displays the correct ContactID number.

Can anyone suggest any other settings i may need to check to see why this may be happening.



Hi guys and gals lol,
Newbie to the forum and world of access.
I have searched the forum for a solution and found one that works in part,
DoCmd.OpenForm "frmfleettruck", acNormal, , "[unitid]=" & Me.searchresults.Column(0)

This takes me from a list box on a double click event which id fine but how do I modify this so that once the frmfleettruck form opens it opens to the selected record but also allows me to view all other records too. At the moment i am taken to that one specific record and cannot see any other records.

Hello all,

I have a form (Case Search Form) with a listbox. The listbox populates from a query (QSearchAll).
I also have a textbox that I am using as a search field.

The listbox populates as it should and the textbox works as it should by searching the listbox.

What I want to do is that when a user double clicks a selection in the listbox, then I would like a form to open and the record for the "Case Number" be pulled from its table.

The code I am using and some of the form designed is another user:

I have incluede the pic of the form with the listbox:

This is the code for the search box:

	Private Sub SearchFor_Change()
'Create a string (text) variable
    Dim strSearchString As String
'Populate the string variable with the text entered in the Text Box SearchFor
    strSearchString = SearchFor.Text
'Pass the value contained in the string variable to the hidden text box SrchText,
'that is used as the sear4ch criteria for the Query QSearchAll
    SrchText.Value = strSearchString
'Requery the List Box to show the latest results for the text entered in Text Box SearchFor

'Tests for a trailing space and exits the sub routine at this point
'so as to preserve the trailing space, which would be lost if focus was shifted from Text Box SearchFor
    If Len(Me.SrchText)  0 And InStr(Len(SrchText), SrchText, " ", vbTextCompare) Then
        'Set the focus on the first item in the list box
            Me.SearchResults = Me.SearchResults.ItemData(1)
        'Requery the form to refresh the content of any unbound text box that might be feeding off the record source of  the
List Box
        'Returns the cursor to the the end of the text in Text Box SearchFor,
        'and restores trailing space lost when focus is shifted to the list box
            Me.SearchFor = strSearchString
            Me.SearchFor.SelStart = Me.SearchFor.SelLength
        Exit Sub
    End If
'Set the focus on the first item in the list box
    Me.SearchResults = Me.SearchResults.ItemData(1)
'Requery the form to refresh the content of any unbound text box that might be feeding off the record source of  the List Box
'Returns the cursor to the the end of the text in Text Box SearchFor
    If Not IsNull(Len(Me.SearchFor)) Then
        Me.SearchFor.SelStart = Len(Me.SearchFor)
    End If
End Sub

Here is the code for the double click event:

	Private Sub SearchResults_DblClick(Cancel As Integer)
    Dim strDocName As String
    Dim strLinkCriteria As String
    strDocName = "PSU"
    strLinkCriteria = "[Case Number]=" & Me![SearchResults]
    DoCmd.OpenForm strDocName, , , strLinkCriteria
End Sub

When I double click the selection, then of course a parameter box opens up. I know that the [Case Number] =" & Me![SearchResults] is wrong, because it is not returning [Case Number] = [Case Number], but I dont not know how to fix this.

I am trying to use the double click event of a listbox to open a form to a specific record. The problem I have is when I double click a record, Access pops up a box asking for PONumber (which is in column 0 of the listbox).

Here is the code that I am using:

	Private Sub lstPOInfo_DblClick(Cancel As Integer)

Dim boStatus As Boolean
Dim strDocName As String
Dim strLinkCriteria As String

    strDocName = "Orders"

    ' function checks to see if the form is open or not
    boStatus = fIsLoaded(strDocName) 
    If boStatus = True Then
       strLinkCriteria = "[PONumber]=" & Me.lstPOInfo.Column(0)
       Forms![Orders].FilterOn = True
       Forms![Orders].Filter = strLinkCriteria
        strLinkCriteria = "[PONumber]=" & Me.lstPOInfo.Column(0)
        DoCmd.OpenForm strDocName, , , strLinkCriteria
    End If
End Sub

I'm sure it's a syntax error on the "strLinkCriteria = "[PONumber]=" & Me.lstPOInfo.Column(0)" line.

Not finding an answer? Try a Google search.