- Katılım
- 30 Ağustos 2010
- Mesajlar
- 59
- Excel Vers. ve Dili
- 2013
- Altın Üyelik Bitiş Tarihi
- 05-02-2021
Merhaba arkadaşlar.
Aşağıdaki kodlarda "run tıme error "-2147467259 (80004005) geçersiz boş kullanımı hatası alıyorum. sebebi ne olabilir.
Private Sub CommandButton1_Click()
Dim con As Object, rs As Object, s As String
Dim yol As String, bas As Date, son As Date
Dim bugun As Date, formul As Variant, i As Long
Set con = CreateObject("adodb.connection")
Set rs = CreateObject("adodb.recordset")
yol = "P:\FIRAT\ORTAK\KADRO.xlsx"
bugun = CDate(Date)
Range("b5:ı90").ClearContents
Range("k5:r90").ClearContents
deneme = (bugun - 60) + 5
formul = Split(Range("h2").Value, "-")
bas = formul(0): son = formul(1)
con.Open "provider=microsoft.ace.oledb.12.0;data source=" & yol & ";extended properties=""excel 12.0;hdr=yes"""
rs.Open "select [SİCİL NO],[ADI-SOYADI],[FİRMA],[ŞUBE],[İŞ BAŞI],[İL],CDATE([İŞ BAŞI])+60 from [eleman$] where clng(cdate([İŞ BAŞI]))<=" & CLng(CDate(deneme)), con, 1, 1
If rs.RecordCount > 0 Then
Range("l5").CopyFromRecordset rs
End If
For i = 5 To Range("m65536").End(3).Row
Cells(i, "k").Value = i - 4
Next i
rs.Close
rs.Open "select [SİCİL NO],[ADI-SOYADI],[FİRMA],[ŞUBE],[İŞ BAŞI],[İL] from [eleman$] where clng(cdate([İŞ BAŞI])) between " & CLng(CDate(bas)) & " and " & CLng(CDate(son)), con, 1, 1
If rs.RecordCount > 0 Then
Range("c5").CopyFromRecordset rs
End If
For i = 5 To Range("c65536").End(3).Row
Cells(i, "b").Value = i - 4
Next i
Set rs = Nothing
Set con = Nothing
yol = vbNullString: deneme = Empty: Erase formul
bas = Empty: son = Empty: bugun = Empty: i = Empty
End Sub
Aşağıdaki kodlarda "run tıme error "-2147467259 (80004005) geçersiz boş kullanımı hatası alıyorum. sebebi ne olabilir.
Private Sub CommandButton1_Click()
Dim con As Object, rs As Object, s As String
Dim yol As String, bas As Date, son As Date
Dim bugun As Date, formul As Variant, i As Long
Set con = CreateObject("adodb.connection")
Set rs = CreateObject("adodb.recordset")
yol = "P:\FIRAT\ORTAK\KADRO.xlsx"
bugun = CDate(Date)
Range("b5:ı90").ClearContents
Range("k5:r90").ClearContents
deneme = (bugun - 60) + 5
formul = Split(Range("h2").Value, "-")
bas = formul(0): son = formul(1)
con.Open "provider=microsoft.ace.oledb.12.0;data source=" & yol & ";extended properties=""excel 12.0;hdr=yes"""
rs.Open "select [SİCİL NO],[ADI-SOYADI],[FİRMA],[ŞUBE],[İŞ BAŞI],[İL],CDATE([İŞ BAŞI])+60 from [eleman$] where clng(cdate([İŞ BAŞI]))<=" & CLng(CDate(deneme)), con, 1, 1
If rs.RecordCount > 0 Then
Range("l5").CopyFromRecordset rs
End If
For i = 5 To Range("m65536").End(3).Row
Cells(i, "k").Value = i - 4
Next i
rs.Close
rs.Open "select [SİCİL NO],[ADI-SOYADI],[FİRMA],[ŞUBE],[İŞ BAŞI],[İL] from [eleman$] where clng(cdate([İŞ BAŞI])) between " & CLng(CDate(bas)) & " and " & CLng(CDate(son)), con, 1, 1
If rs.RecordCount > 0 Then
Range("c5").CopyFromRecordset rs
End If
For i = 5 To Range("c65536").End(3).Row
Cells(i, "b").Value = i - 4
Next i
Set rs = Nothing
Set con = Nothing
yol = vbNullString: deneme = Empty: Erase formul
bas = Empty: son = Empty: bugun = Empty: i = Empty
End Sub