Attribute VB_Name = "Global_Code"
Option Explicit

'deklarasi di module agar dapat dikenali disemua
'form dalam project
Public db As ADODB.Connection
Public cmd As ADODB.Command
Public rec As ADODB.Recordset
Public erroritem As ADODB.Error
Public recinst1 As ADODB.Recordset
Public recinst2 As ADODB.Recordset
Public penanda, Lbl_Tahun, Lbl_Semester As String


Sub pesanAdoerror()
  Dim Pesan As String
  For Each erroritem In db.Errors
    With erroritem
      '
      'pesan = pesan & .NativeError & "-->" & _
      '            .Description & vbCrLf
      '
      Select Case .NativeError
        Case 32
          Pesan = Pesan & " Data sudah dihapus oleh orang lain..." & vbCrLf
        Case 547
          Pesan = Pesan & " ada relational dengan tabel yang lain.." & vbCrLf
        Case 2627
          Pesan = Pesan & " kodekursus sudah ada!!!" & vbCrLf
        Case 3621
          Pesan = Pesan & " perintah dibatalkan!!!" & vbCrLf
        Case 8152
          Pesan = Pesan & " pajang data melebihi batas!!!" & vbCrLf
        Case Else
          Pesan = Pesan & "nomor ado error : " & .NativeError & vbCrLf & _
            "keterangan : " & .Description
      End Select
    End With
  Next
  MsgBox Pesan
End Sub


