ok there is my code. I put it on a form to do a search with a button "search". The code is on click_event. So at the line with a * it give me an error with the compatibility of type. thanks to look at it. The field "no_conn" is numeric. I tried this same code in another form and the field is "text" and it's works. So what I should do?
(I use Access2000)
Private Sub recherche_conn_click()
On Error GoTo Err_recherche_conn_Click
Dim strSearch As String
Dim rst As Object
StrSearch = "no_conn = """ & Modifiable63 & """"
set rst = me.RecordsetClone
**rst.FindFirst strSearch
With rst
if .NoMatch Then
msgbox MSG_CONNOTFOUND
Else
with Me
.Bookmark = rst.Bookmark
.Modifialbe63.SetFocus
.Modifiable63.Text = ""
.no_conn.SetFocus
End With
End If
rst.Close
End With
Exit_recherche_conn_Click:
Exit Sub
Err_recherche_conn_Click:
MsgBox Err.Description
Resume Exit_recherche_conn_click
End Sub
Mymy
(I use Access2000)
Private Sub recherche_conn_click()
On Error GoTo Err_recherche_conn_Click
Dim strSearch As String
Dim rst As Object
StrSearch = "no_conn = """ & Modifiable63 & """"
set rst = me.RecordsetClone
**rst.FindFirst strSearch
With rst
if .NoMatch Then
msgbox MSG_CONNOTFOUND
Else
with Me
.Bookmark = rst.Bookmark
.Modifialbe63.SetFocus
.Modifiable63.Text = ""
.no_conn.SetFocus
End With
End If
rst.Close
End With
Exit_recherche_conn_Click:
Exit Sub
Err_recherche_conn_Click:
MsgBox Err.Description
Resume Exit_recherche_conn_click
End Sub
Mymy