Skip to main content

AccessTr.neT


Access İçinden Windows Gezginini Yönetmek

Access İçinden Windows Gezginini Yönetmek

#2
Aşağıdaki kodu dener misiniz?
Kod:
Dim MyFile As String
Dim txtDosyaAdi() As String

MyFile = Dir$(CurrentProject.Path & "\Müşteriler\_Tarananlar\*.pdf")

Do While MyFile <> ""
xMyFile = MyFile
   MyFile = Dir$
txtDosyaAdi = Split(xMyFile, "_")

xKonum = CurrentProject.Path & "\Müşteriler\_Tarananlar\"

Xhedef = CurrentProject.Path & "\Müşteriler\" & txtDosyaAdi(0)
If Dir(Xhedef, vbDirectory) = "" Then MkDir Xhedef
Xhedef = Xhedef & "\" & Replace(txtDosyaAdi(3), ".pdf", "")
If Dir(Xhedef, vbDirectory) = "" Then MkDir Xhedef
Xhedef = Xhedef & "\" & txtDosyaAdi(1)
If Dir(Xhedef, vbDirectory) = "" Then MkDir Xhedef
Xhedef = Xhedef & "\" & txtDosyaAdi(2)
If Dir(Xhedef, vbDirectory) = "" Then MkDir Xhedef
Xhedef = Xhedef & "\"

Name xKonum & xMyFile As Xhedef & xMyFile
'DoCmd.RunSQL "insert into 2_Dosya_Link_T (MUSTERI_ADI,DOSYA_LINK) values ('" & txtDosyaAdi(0) & "', '" & Xhedef & xMyFile & "');"
Loop

sql kodunu da loop döngüsünün içine eklerseniz sorun kalmaz
tablo ilişkileri kesilip aşağıdaki kodu yazınca sorunsuz çalıştı
Dim MyFile As String
Dim txtDosyaAdi() As String
'On Error Resume Next

ReDim DirectoryListArray(1000)

MyFile = Dir$(CurrentProject.Path & "\Müşteriler\_Tarananlar\*.pdf")
Counter = 0
Do While MyFile <> ""
   DirectoryListArray(Counter) = MyFile
   MyFile = Dir$
   Counter = Counter + 1
Loop

For x = 0 To Counter - 1
xMyFile = DirectoryListArray(x)
txtDosyaAdi = Split(xMyFile, "_")

xKonum = CurrentProject.Path & "\Müşteriler\_Tarananlar\"

Xhedef = CurrentProject.Path & "\Müşteriler\" & txtDosyaAdi(0)
If Dir(Xhedef, vbDirectory) = "" Then MkDir Xhedef
Xhedef = Xhedef & "\" & Replace(txtDosyaAdi(3), ".pdf", "")
If Dir(Xhedef, vbDirectory) = "" Then MkDir Xhedef
Xhedef = Xhedef & "\" & txtDosyaAdi(1)
If Dir(Xhedef, vbDirectory) = "" Then MkDir Xhedef
Xhedef = Xhedef & "\" & txtDosyaAdi(2)
If Dir(Xhedef, vbDirectory) = "" Then MkDir Xhedef
Xhedef = Xhedef & "\"

Name xKonum & xMyFile As Xhedef & xMyFile

DoCmd.RunSQL "insert into 2_Dosya_Link_T (MUSTERI_ADI,DOSYA_LINK) values ('" & _
             txtDosyaAdi(0) & "', '#" & Xhedef & xMyFile & "#');"
Next
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: Access İçinden Windows Gezginini Yönetmek - Yazar: berduş - 19/03/2019, 16:05
Task