Opening a form based on a record selected in a list box

So now that I have the list box working correctly I am needing the ability to select a record in the list box, double click it and a form displaying everything associated with the record is displayed.  

I have a unique ID; Hardware_ID and the form I need it to open is frm_Inventory
The name of the list box is HWB_LIST

John SheehySystem Security ManagerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Fabrice LambertConsultingCommented:

Use the double click event of your list box:
Private Sub HWB_LIST_DblClick(Cancel As Integer)
    Select Case HWB_LIST.Value
        '// ect ect ...
    End Select
End Sub

Open in new window

John SheehySystem Security ManagerAuthor Commented:
I don't know how to tell the double click event to open the correct record.  Maybe something like this?

stLinkCriteria = "[Hardware_ID]=" & "'" & Me.HWB_LIST.Hardware_ID & "'"
stDOCName = "frm_Inventory"

        DoCmd.OpenForm stDOCName, , , stLinkCriteria

    End If

John SheehySystem Security ManagerAuthor Commented:
So I figured it out.  The solution is:

stLinkCriteria = "[Hardware_ID]=" & Me.HWB_LIST.Value
stDOCName = "frm_Inventory"

        DoCmd.OpenForm stDOCName, , , stLinkCriteria


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
John SheehySystem Security ManagerAuthor Commented:
I was able to figure out before an expert commented on it
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.