I am using a form called 'Search Client" which has a listbox called 'List45' in it. I want t double click on list box and for another form called 'Frm_Client' to open with the record that was double clicked. My unique ID is ClientID. I have used the code below found on this site but obviously misinterpretted it as am getting 'data type mismatch' error. Can anyone see what ive done?
Private Sub List45_DblClick(Cancel As Integer)
Dim ctl As Control
Set ctl = Forms![Search Client]!List45
Dim varItm As Variant
For Each varItm In ctl.ItemsSelected
DoCmd.OpenForm "frm_client", acNormal, , "[ClientID]= '" & ctl.ItemData(varItm) & "'"
Next
Private Sub List45_DblClick(Cancel As Integer)
Dim ctl As Control
Set ctl = Forms![Search Client]!List45
Dim varItm As Variant
For Each varItm In ctl.ItemsSelected
DoCmd.OpenForm "frm_client", acNormal, , "[ClientID]= '" & ctl.ItemData(varItm) & "'"
Next