i have a list of data from database, when i click on an item from this list the value from list should go to the database through SQL criteria, but it doesn't happen, it throws "Data Type mismatch in criteria expression error" (error is hightighted with red in code part). Datatype of list is General (i changed also to a Number) and the column type in db is index (or number), what's wrong with the datatypes? Thanks in advance.
Public cnn As New ADODB.Connection
Public rst As New ADODB.Recordset
Public r As New ADODB.Recordset
Private Sub Form_Load()
cnn.ConnectionString = _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & _
"C:\8.mdb"
cnn.Open
rst.Open "Select * from material", cnn, adOpenDynamic, adLockOptimistic
Do While Not rst.EOF
List1.AddItem rst(1)
rst.MoveNext
Loop
rst.Close
End Sub
Private Sub List1_Click()
rst.Open "SELECT price from material where id_material='" & List1 & "'", cnn, adOpenDynamic, adLockOptimistic
Text1 = IIf(IsNull(rst(0)), 0, rst(0))
rst.Close
End Sub