Retrieving Primary Key from a listbox?

kawi6rr

Registered User.
Local time
Yesterday, 22:03
Joined
Jun 29, 2010
Messages
28
I’m trying to set up a pop up window for quick viewing by double clicking a listbox value. I’m having trouble finding the selected value (Primary Key) and feeding it to the popup form. In the bolded code below "output_window" is the listbox.

Error: Property let procedure not defined and property get procedure did not get a value.

Private Sub outPut_Window_DblClick(Cancel As Integer)
On Error GoTo Err_btnReviewPopUP_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Occ_Popup"

stLinkCriteria = "[Occ_ID]=" & Me!outPut_Window![Occ_ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_btnReviewPopUP_Click:
Exit Sub

Err_btnReviewPopUP_Click:
MsgBox Err.Description
Resume Exit_btnReviewPopUP_Click
End Sub

Any help is greatly appreciated, Thanks!!
 
Last edited:
For the list box, the key value must be the bound column of the list box. From what you show the key value is numeric, is that correct?

Also, your code is off a little, it should be this:

Code:
stLinkCriteria = "[Occ_ID]=" & Me.outPut_Window
 
Solved!

Thanks!! You are correct I didn't have the primary key in the query I was using so it was looking at the persons name. I added in the primary key and it works.
 
Glad to hear that you sorted it out. Good luck with your database.
 

Users who are viewing this thread

Back
Top Bottom