List box questions

SteveL

Registered User.
Local time
Today, 17:19
Joined
Dec 3, 2004
Messages
60
I have a list box on a form and want to do the following:

1) If the user double-clicks on a specific record in the listbox, have a 2nd form open right to that selected record.

or

2) If the user double-clicks in the white area below the displayed records, have the 2nd form open to an empty record so he/she can create a new record.

Can all of this be done?

Here is my code so far. When the user double-clicks anywhere in the list box, the 2nd form opens but displays all the records associated to the key field. Then they have to navigate through the records to edit an existing record or create a new record.

Private Sub List131_DblClick(Cancel As Integer)

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmProjectDetail"

stLinkCriteria = "[JobN]=" & Me![List131].Column(1)
DoCmd.OpenForm stDocName, , , stLinkCriteria

End Sub
 
Your code uses;
Code:
Me![List131].Column(1)
To identify the column of your List box that hold records for JobN, This would mean that records for JobN reside in the second column of your list box as the columns are numbered from zero up. If in fact JobN resides in the first column of the list box. In which case you can use;
Code:
stLinkCriteria = "[JobN]=" & Me.List131.Column(0)
or simply;
Code:
stLinkCriteria = "[JobN]=" & Me.List131
 

Users who are viewing this thread

Back
Top Bottom