Skip to main content

AccessTr.neT


tüm tabloları tek bir düğme ile silme

tüm tabloları tek bir düğme ile silme

Çözüldü #2
Önce ilişkileri silmeniz için bir fonksiyon

Public Function tumIliskileriSil()
Dim db As Database ' Current DB
Dim rex As Relations ' Relations of currentDB.
Dim rel As Relation ' Relationship being deleted.
Dim iKt As Integer ' Count of relations deleted.
Dim sMsg As String ' MsgBox string.

Set db = CurrentDb()
Set rex = db.Relations

iKt = rex.Count

Do While rex.Count > 0
rex.Delete rex(0).Name
Loop

End Function

sonra tabloları temizlemek için fonksiyon

Public Function tumTablolariSil()
On Error GoTo Hata_Yakala

Dim vt As DAO.Database
Dim rst As DAO.Recordset
Dim tabloSorgu As String

Set vt = CurrentDb()

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

Set rst = vt.OpenRecordset(tabloSorgu)

If Not rst.EOF Then
rst.MoveFirst

Do Until rst.EOF
rst.MoveNext
tabloAdi = "DROP TABLE " & rst!Name
vt.Execute tabloAdi
Loop
End If

rst.Close

Set rst = Nothing

Hata_Yakala:
MsgBox Err.Description
Exit Function

End Function

bir butonun tıklanma olayında

tumIliskileriSil
tumTablolariSil
AccessTr.Net teknik konular içeren bir sitedir. Bu tip sitelerde en iyi şekilde yardım alabilmeniz için Site Kurallarını mutlaka okumanız ve buna göre hareket etmeniz lazım.
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
Cvp: tüm tabloları tek bir düğme ile silme - Yazar: alpeki99 - 29/01/2013, 01:39