Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

List Box Double Click

Status
Not open for further replies.

manny1234

IS-IT--Management
Mar 13, 2006
58
US
I have a list box set up in a form. I want to be able to double click an item in the list box and have it open a seperate form with the corresponding record. Here is what I have.
Code:
Private Sub List0_DblClick(Cancel As Integer)
DoCmd.OpenForm "MD_ActView", , , "" & Me![VPSID] & " = [ID]"
End Sub
The problem is it pulls the VPSID from the first record and not the record being selected. IE
Code:
vpsid     name    somethingelse
123       dude    goes places
321       himom   stays home

If I select 321 it pulls up the record for 123...
 
DoCmd.OpenForm "MD_ActView", , , [ID]= " & Me!VPSID

Looks like you had them turned around ;-)

Herman
Say no to macros
 
No beans. Same thing when it is switched up.

Code:
Private Sub List0_DblClick(Cancel As Integer)
DoCmd.OpenForm "MD_ActView", , , "[ID] = " & Me![VPSID] & ""
End Sub
 
heh! here is the working code

Code:
Private Sub List0_DblClick(Cancel As Integer)
DoCmd.OpenForm "MD_ActView", , , "[ID] = " & Me![List0] & ""
End Sub

I needed to call the value of the list box not the VPSID for the form...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top