hey there,
Here's my complete code for a delete button that deletes a record in a Heirachical Flex Grid.
Dim rsTour As New ADODB.Recordset
Dim cn As New ADODB.Connection
Dim strSQL As String
cn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;" & _
"Data Source=" & App.Path & "\Luckshan Tours & Travels.mdb;" & _
"Persist Security Info:False"
cn.Open
msg = MsgBox("Delete Record?", vbYesNo)
If msg = vbYes Then
strSQL = "Delete From Tour Where [Tour ID] = '" & fgdTour.TextMatrix(fgdTour.Row, 1) & "'"
cn.Execute strSQL
strSQL = "Select * From Tour"
rsTour.Open strSQL, cn, adOpenStatic, adLockPessimistic
Set fgdTour.DataSource = rsTour
End If
Set fgdTour.DataSource = rsTour
If rsTour.RecordCount <> 0 Then
rsTour.Update
End If
The code works great for two of my forms, but for the other two it doesn't. It gives me an error saying "Data type mismatch in criteria expression" and highlights the statement :
cn.Execute strSQL
Please help.... I've gone over and over the code for errors but could find none, I mean it works perfectly for the other two forms.