Incompatibily of type

mymy

Registered User.
Local time
Today, 00:55
Joined
Jun 18, 2001
Messages
16
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
 
Mymy,

What you are doing is putting quotes around the variable by using double quotes... Two quotes next to each other will print a single quote, similar to the ampersand(&). This only needs to be done to string variables... Numerical variables do not need quotes... Try this code instead of what you had...

StrSearch = "no_conn = " & Modifiable63

A little tip too, when you are using string variables, you should always use the tic marks('). It makes it easier to read. Hope this helps.

Doug
 

Users who are viewing this thread

Back
Top Bottom