The code assumes that:
a) this is not a multi-select list box;
b) the bound column of the list box is a number field;
c) the number field is named ID;
d) some value is chosen when you double-click the list box.
In form design, right-click the list box and choose Properties.
On the Data tab of the Properties box, is the Bound Column property 1?
What is the RowSource? Which is the first field in this table/query?
Change the "ID" if the field has a different name.
Add extra quotes if the field is a Text type (not a number type), e.g.:
strWhere = "[ID] = """ & Me.Listbox_Linked_Interface & """"
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Reply to group, rather than allenbrowne at mvps dot org.
Antonio said:
Thank you for your response Allen.
I put the code in:
Private Sub Listbox_Linked_Interface_DblClick(Cancel As Integer)
Dim frm As Form
Dim strWhere As String
strWhere = "[ID] = " & Me.Listbox_Linked_Interface
Set frm = Forms![Form_Interfaces]
With frm.RecordsetClone
.FindFirst strWhere
If .NoMatch Then
MsgBox "Not found. Is the form filtered?"
Else
frm.Bookmark = .Bookmark
End If
End With
End Sub
But I am getting a run time error of a missing operator in expression.
When
I debug the '.FindFirst strWhere' line is selected. You have to excuse me
but
I am still relatively unfamiliar with code. Cheers!