Hi, I have a table "tbWorkOrder" with fields WONumber (Integer), EqID (text), EqDescription (text), EqLocation (text), plus 15 other fields.
Form has listbox (lbWorkOrders) which is linked to table tbWorkOrder, row source is linked by query builder, list records in the table.
Command button "unhides" listbox which lists the records.
I want to be able to double click on a record and have all fields for that particular record displayed in the relevant text boxes on my form.
Have the below code but when it gets to the line Me.Bookmark it fails with message "no current record"
I have similar code working from a combo box on another form and it works ok.
Can anyone help with why this particular code fails. Many thanks Colin
Private Sub lbWorkOrders_Click()
Dim strWO As Integer
Dim rsViewWO As Recordset
strWO = lbWorkOrders.Column(0)
Set rsViewWO = Me.Recordset.Clone
rsViewWO.FindFirst "[EqID] = " & strWO & ""
If Not rsViewWO.NoMatch Then
MsgBox "Record Not Found"
Else
Me.Bookmark = rsViewWO.Bookmark
txWONumber = [tbWorkOrder.WONumber]
cbEquipID = [tbWorkOrder.EqID]
txEquipDesc = [tbWorkOrder.EqDescription]
txEquipLoc = [tbWorkOrder.EqLocation]
txReceivedBy = [tbWorkOrder.ReceivedBy]
txWODate = [tbWorkOrder.WODate]
txEmployeeID = [tbWorkOrder.EmployeeID]
txFirstName = [tbWorkOrder.FirstName]
txLastName = [tbWorkOrder.LastName]
End If
Set rsViewWO = Nothing
Me.txWONumber.SetFocus
Me.lbWorkOrders.Visible = False
End Sub