Public Sub dosyayabak()
Set dosya = New FileSystemObject
If dosya.FileExists(App.Path &
"\deneylistesi.mdb") = False Then
Dim oDB As ADOX.Catalog
Dim sDBPAth As String
Dim sConStr As String
Dim oCn As ADODB.Connection
Dim oCM As ADODB.Command
' ------------------------
' Set the Path and Connection String
' ------------------------
sDBPAth = App.Path & "\deneylistesi.mdb"
sConStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=" & sDBPAth & ";"
' ------------------------
' Create New ADOX Object
' ------------------------
Set oDB = New ADOX.Catalog
oDB.Create sConStr
Set oCn = New ADODB.Connection
oCn.ConnectionString = sConStr
oCn.Open
Set oCM = New ADODB.Command
oCM.ActiveConnection = oCn
oCM.CommandText = "Create Table deneyler (" &
"[Kimlik] long, " & "[Deney_Adı] Text(255), " &
"[Standart_No] Text(20), " & "[Deney_Turu] Text(20), "
& "[Uygulama] Text(20)," & "[Ucreti] currency"
& ")"
oCM.Execute
' ------------------------
' Release / Destroy Objects
' ------------------------
If Not oCM Is Nothing Then Set oCM = Nothing
If Not oCn Is Nothing Then Set oCn = Nothing
If Not oDB Is Nothing Then Set oDB = Nothing
End If
' ------------------------
' Error Handling
' ------------------------
Err_Handler:
If Err <> 0 Then
Err.Clear
Resume Next
End If
End Sub
Hiç yorum yok:
Yorum Gönder