-
September 26th, 2014, 09:37 AM
#1
DBGrid Refresh
What am I doing wrong? When I select a row in a DBGrid and I click my delete button it's supposed to delete the row from the grid. The first time through it doesn't, but if I selecet a second row to delete the DBGrid refreshes and both rows are gone. if I select a 3rd and click the delete button, the row deletes and the DBGrid refreshes deleting the row. Why is it the first time through the DBGrid never refreshes, but other subsequent times it does.
Private Sub cmdDelete_Click()
Dim I As Long
If DBGrid1 = "" Then
Call subErrorRoutine("You cannot delete a record when there is no data present.", 0)
Else
With DBGrid1
'Debug.Print .Row
If .Row >= 0 Then
' Confirm Delete
If MsgBox("Do you really want to Delete this Record?", vbQuestion + vbYesNo + vbDefaultButton2, "Delete record") = vbYes Then
' Delete current row
'NOTE: for .RowBookmark current Row must be visible
Call DeleteRow(.Row)
End If
Else
MsgBox "You must select a row to Delete!", vbExclamation + vbOKOnly, "Delete record"
End If
With frmSendEmail.datMedia.Recordset
frmSendEmail.datMedia.RecordSource = "SELECT * FROM TRANSACTIONS"
frmSendEmail.datMedia.Refresh
End With
'frmSendEmail.datMedia.Recordset.Requery
frmSendEmail.DBGrid1.Refresh
End With
End If
End Sub
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|