Skip to main content

AccessTr.neT


Tablo Varmı Kontrol Ettirmek

Tablo Varmı Kontrol Ettirmek

#2
Referanslara "ActiveX Data Object X.X Library" referansını ekle,

Aktif Veritabanı için

Dim GTabloAdi, GSorgu As String
Dim GKontrol1, GKontrol2

Dim rst As Recordset

GKontrol1 = False
GKontrol2 = False

GSorgu = "SELECT MSysObjects.Name FROM MSysObjects " & "WHERE Left$([Name],1)<>'~' AND Left$([Name],4)<>'MSys' " & "AND MSysObjects.Type =1 ORDER BY MSysObjects.Name"

Set rst = CurrentDb().OpenRecordset(GSorgu)

rst.MoveFirst
       
   Do Until rst.EOF
             
       If rst!Name = "Kişiler" Then
       GKontrol1 = True
       End If
       
       If rst!Name = "bölümler" Then
       GKontrol2 = True
       End If
           
   rst.MoveNext
           
   Loop

   If GKontrol1 = True Then
       MsgBox ("Kişiler Tablosu Var")
   Else
       MsgBox ("Kişiler Tablosu Yok")
   End If
   
   If GKontrol2 = True Then
       MsgBox ("bölümler Tablosu Var")
   Else
       MsgBox ("bölümler Tablosu Yok")
   End If

rst.Close
       
Set rst = Nothing


Farklı veritabanı için

Dim cnnDB As ADODB.Connection
Dim rstList As ADODB.Recordset
Dim GKontrol1, GKontrol2

Dim GVeriTabani As String

GKontrol1 = False
GKontrol2 = False

GVeriTabani = "D:\Test\Test.mdb"

Set cnnDB = New ADODB.Connection

With cnnDB
   .Provider = "Microsoft.Jet.OLEDB.4.0"
   .Open GVeriTabani
End With

  Set rstList = cnnDB.OpenSchema(adSchemaTables)

  With rstList
     Do While Not .EOF
     
        If .Fields("TABLE_TYPE") <> "VIEW" And "Kişiler" = .Fields("TABLE_NAME") Then
           GKontrol1 = True
        End If
       
       If .Fields("TABLE_TYPE") <> "VIEW" And "bölümler" = .Fields("TABLE_NAME") Then
           GKontrol2 = True
        End If
       
        .MoveNext
     Loop
     
      If GKontrol1 = True Then
       MsgBox ("Kişiler Tablosu Var")
   Else
       MsgBox ("Kişiler Tablosu Yok")
   End If
   
   If GKontrol2 = True Then
       MsgBox ("bölümler Tablosu Var")
   Else
       MsgBox ("bölümler Tablosu Yok")
   End If
     
  End With
  cnnDB.Close
  Set cnnDB = Nothing
Cevapla

Bir hesap oluşturun veya yorum yapmak için giriş yapın

Yorum yapmak için üye olmanız gerekiyor

ya da

Bu Konudaki Yorumlar
Tablo Varmı Kontrol Ettirmek - Yazar: bibib - 25/06/2018, 15:46
Cvp: Tablo Varmı Kontrol Ettirmek - Yazar: ozanakkaya - 25/06/2018, 17:08
Cvp: Tablo Varmı Kontrol Ettirmek - Yazar: bibib - 25/06/2018, 17:27
Cvp: Tablo Varmı Kontrol Ettirmek - Yazar: ozanakkaya - 25/06/2018, 17:49
Cvp: Tablo Varmı Kontrol Ettirmek - Yazar: bibib - 27/06/2018, 11:07