I needed to change the findrecord macro into VBA as i needed another VBA command in the after update event for a list box. I have been told that in order to achieve the results of the find record macro that, when an option of the listbox is selected, the whole record is opened in the form (The listbox is in the form in question) to use ADO, so far i have got:
Private Sub lstContacts_AfterUpdate()
Dim rst As ADODB.Recordset
Dim val As String
val = Me![lstContacts].Value
Set rst = New ADODB.Recordset
rst.Open "SELECT * FROM Contacts", CurrentProject.Connection, adOpenKeyset, adLockOptimistic
rst.Find "[ContactID] ='" & val & "'"
If Not rst.EOF Then
'The record was found
'Do Something Here
Firstly i am unsure as to what is happening, secondly i a unsure as to how to actually open the form.