Unanswered: accessing form from selected listbox record
I have a listbox in a form. I am writing code for an "OK" button that will allow a record from the listbox to be chosen. When the record is selected and the OK button is clicked, the data entry form with the record in it should be displayed. The problem is: I get an error that says that the form can't be found. I know it is spelled right and is case-specific. Any guesses on what else I could be doing wrong?
We'll need to know a bit more about how you're doing this. Posting the actual code would help.
Sounds like you want to do this:
Private Sub cmdOK_Click()
Dim iKey As Integer
' This assumes the bound column of List0 contains the index, which I called YourKey in this example
' YourKey would be the index field of the table.
If Len(Me.List0 & "") = 0 Then Exit Sub
iKey = Me.List0
DoCmd.OpenForm "YourForm", acNormal, , "[YourKey] = " & Format(iKey)