Hi
I have a program where i have created different types of querys to run to get information from my MS Access database but i can not work out how to run a Delete query.
This is the code i have so far:
Dim varConn As New ADODB.Connection
Dim varCmd As New ADODB.Command
Dim varRecSet As New ADODB.Recordset
Dim varSQLString As String
If varEnteredSelect = “” Then
lblInfo.Text = “NOTHING SELECTED TO REMOVE”
Exit Sub
End If
varSQLString = “DELETE * FROM tblUpdate WHERE LEFT(STKCODE,13) ='” & varEnteredSelect & “‘”
varConn.ConnectionString = “Provider=Microsoft.Jet.OLEDB.4.0;” & _
“Persist Security Info=False;” & _
“Data Source = DATAPATH”
varConn.Open()
varCmd.CommandText = “tblUpdate”
varCmd.CommandType = ADODB.CommandTypeEnum.adCmdText
varRecSet.CursorLocation = ADODB.CursorLocationEnum.adUseClient
varRecSet.CursorType = ADODB.CursorTypeEnum.adOpenKeyset
varRecSet.LockType = ADODB.CursorTypeEnum.adOpenDynamic
As you can see from the SQLString i am trying to Delete a row from the database, based on the input from the user earlier in the program.
I would be very grateful for any help or different suggestions. If any more details are required let me know.
Kind Regards