AccessTr.neT
Do Until Sorgusu Kullanımı Hakkında - Baskı Önizleme

+- AccessTr.neT (https://accesstr.net)
+-- Forum: Microsoft Access (https://accesstr.net/forum-microsoft-access.html)
+--- Forum: Access Cevaplanmış Soruları (https://accesstr.net/forum-access-cevaplanmis-sorulari.html)
+--- Konu Başlığı: Do Until Sorgusu Kullanımı Hakkında (/konu-do-until-sorgusu-kullanimi-hakkinda.html)

Sayfalar: 1 2


RE: Do Until Sorgusu Kullanımı Hakkında - orhantanriverdi - 30/09/2022

bir butono asagidaki kodu ekleyip, Link yolunu duzenleyip denermisin, " sFileName = "\Downloads\" & "toplunbt.xlsb""



Private Sub CMDEXCEL_Click()
On Error GoTo HATA
Set myFile = Application.FileDialog(msoFileDialogSaveAs)
With myFile
.Title = "Choose File"
.AllowMultiSelect = False
.ButtonName = "&Export"
.InitialFileName = CurrentProject.Path & "\" & "toplunbt_" & Format(Now(), "dd.mm.yyyy_HH.mm") & ".xlsb"
.Title = "Export file toplunbt"
If .Show <> -1 Then
MsgBox "File not saved, you have cancelled!"
Exit Sub
End If
FileSelected = .SelectedItems(1)
End With
If InStr(FileSelected, ".xlsb") = 0 Then
FileSelected = FileSelected & ".xlsb"
Else
End If

sFileName = "\Downloads\" & "toplunbt.xlsb"
Set xlApp = CreateObject("Excel.Application")
Set xlWb = xlApp.Workbooks.Open(sFileName)
Set xlWs = xlWb.Worksheets(1)

Set rst = CurrentDb.OpenRecordset("SELECT Adi, Soyadi, sicil, Emekli_sicil_no, Tc_kimlik, Baba_adi, Anne_adi, Dogum_yeri_ili, Dogum_yeri_ilcesi FROM Personel_Bilgileri; ;", dbOpenDynaset)
xlWs.Activate
xlWs.Range("A2").CopyFromRecordset rst
Set rst = Nothing


sFileName = FileSelected
xlWs.SaveAs sFileName
HATA:


Set xlWb = Nothing
Set xlWs = Nothing

xlApp.Quit

MsgBox ("MASAUSTUNE GONDERILDI " & sFileName)
End Sub


RE: Do Until Sorgusu Kullanımı Hakkında - angelos - 30/09/2022

masaüstüne gönderildi diyor masaüstünde birşey yok, ayrıca benim Excel formatına uygunmu acaba bu kodlar tam emin olamadım


RE: Do Until Sorgusu Kullanımı Hakkında - angelos - 30/09/2022

tamam arkadaşlar sorunu çözdüm teşekkür ederim. Araştırıken şablon kullanmak zorunda olmadığımı da anladım yeni bir Excel dökümanı oluşturup
bu kodlar ile tam istediğim gibi oldu aynı sıkıntıyı yaşayan arkadaş olursa işini görmesi için ekledim tekrar teşekkür ederim
Kod:
Dim i
       i = 4


        Do Until rs1.EOF
        
        
        excl.Cells(i, "A") = rs1(0)
        excl.Cells(i, "B") = rs1(1)
        excl.Cells(i, "C") = rs1(2)
        excl.Cells(i, "D") = rs1(3)
        excl.Cells(i, "E") = rs1(4)
                
      i = i + 1
      
  rs1.MoveNext
      
    Loop
  
rs1.Close




RE: Do Until Sorgusu Kullanımı Hakkında - berduş - 30/09/2022

Copyfromrecordseti araştırın döngüye gerek yok