Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21238

Deleted in the database (MS access) but did not refresh in VB. HELP!

$
0
0
Im trying to delete records in a table. I've done it successfully but the datagrid does not refresh. what should i do? here's my code on cmdDelete:

Private Sub CmdDel_Click(Index As Integer)
'Declaring Variable to be used
Dim MyConn As ADODB.Connection
Dim mobjCmd As ADODB.Command
Dim mobjRst As ADODB.Recordset

'connecting to DB FB_CofF_Sync_test11_2000.mdb
Set MyConn = New ADODB.Connection
MyConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\Chums\Documents\FB_DB\FB_CofF_Sync_test11_2000.mdb;Persist Security Info=False"
MyConn.Open
Set mobjCmd = New ADODB.Command
Set mobjCmd.ActiveConnection = MyConn
mobjCmd.CommandType = adCmdText

'check if you really want to delete this record
If MsgBox("Are you sure you want to delete all record?", vbYesNo + vbQuestion, "Delete?") = vbNo Then
Exit Sub
End If

'If DELETE YES = TRUE execute command
mobjCmd.CommandText = "DELETE * FROM f_7_fSpecies_new"
mobjCmd.Execute

DataGrid1.Refresh

Exit Sub

Viewing all articles
Browse latest Browse all 21238

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>