Change record by clicking list box

George Bowyer

Registered User.
Local time
Today, 18:30
Joined
May 17, 2004
Messages
50
I have a form on which I change or enter tasks in an underlying table.

On the form I have a list box [lstTasks] which displays all of the tasks in the table.

When I enter or edit a task, I have a button to click which requeries the list box.

I want to be able to double click the list box to move the form to the appropriate record.

I have tried two ways of doing this:

Private Sub lstTasks_DblClick(Cancel As Integer)

Forms!frmTasks.RecordsetClone.FindFirst "[fldTaskCode] = " & lstTasks
Forms!frmTasks.Bookmark = Forms!frmTasks.RecordsetClone.Bookmark

End sub


When i try this I get: Run Time error 3070. The Microsoft Jet database engine does not recognise {Insert appropriate code here} as a valid field name or expression.


and

Private Sub lstTasks_DblClick(Cancel As Integer)

Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[fldTaskCode] = " & str(Me![lstTasks])
Me.Bookmark = rs.Bookmark

End Sub


Where I get: Run time error 13. Type Mismatch


lstTasks has the bound column set for the appropriate code.
fldTaskCode is a text field.

I am running Access 2003 (11.6566.8132) SP2

Can anyone please advise me how to acheive the intended result?

Thanks.

George Bowyer
 
Try the second method with this change:

rs.FindFirst "[fldTaskCode] = '" & Me.[lstTasks] & "'"
 
Yep, that did it.

Thank you.
 

Users who are viewing this thread

Back
Top Bottom