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

[ANOTHER] Error:3704 Operation Is Not Allowed When Object Is Closed

$
0
0
I know this question is to silly to ask, because there are many topic about this error, but I can't find the one that really solve my problem, I got this Error when I'm tryng to delete some record, here is my code.
Code:

Private Sub Cmd_Hapus_Click()
  On Error GoTo SalahHapus
  Dim X As Byte
  X = MsgBox("Apakah Anda Yakin Data Akan Dihapus?" + Chr(13) + _
  "Jika Benar Pilih Yes dan jika salah pilih No", _
  vbYesNo + vbQuestion, "Menghapus Data")
  If Not Rs_Pelanggan.RecordCount = 0 Then
    If X = vbYes Then
      Rs_Mutasi.Find "Kd_Plg='" + T_Plg(0) + "'", , adSearchForward, 1
      Rs_Piutang.Find "Kd_Plg='" + T_Plg(0) + "'", , adSearchForward, 1
      If (Rs_Mutasi.EOF) And (Rs_Piutang.EOF) Then
        Rs_Pelanggan.Delete
        MsgBox "Data sudah terhapus", vbOKOnly + vbInformation, "Data Terhapus"
        If Rs_Pelanggan.BOF Then
          Rs_Pelanggan.MoveNext
        ElseIf Rs_Pelanggan.EOF Then
          Rs_Pelanggan.MovePrevious
        Else
        End If
    Else
      MsgBox "Data tidak dapat dihapus," + Chr(13) + _
      "Karena masih terhubung dengan Tabel Mutasi dan Tabel Piutang", _
      vbOKOnly, "Data Tidak Dapat Dihapus"
      Exit Sub
    End If
    Else
      MsgBox "Data Tidak Jadi Dihapus", _
      vbOKOnly + vbInformation, "Tidak Jadi Menghapus"
    End If
  Else
    MsgBox "Data masih kosong", vbOKOnly + vbInformation, "Data Kosong"
  End If
  Bersih
  Isi
  Navigasi
  Kunci
  Exit Sub
SalahHapus:
    MsgBox "Error:" & Err & " " & Err.Description
End Sub

Sorry the message in that coding is in Bahasa,
Someone please Help Me:confused:

Viewing all articles
Browse latest Browse all 21897

Trending Articles



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