Skip to main content

AccessTr.neT


Rapor Kayıt Kaynağı Değiştirme Vba

Rapor Kayıt Kaynağı Değiştirme Vba

#18
If Me.AclRMynSec = "2020" Then
DoCmd.OpenForm "FRADYASYONMYN", acDesign
Forms!FRADYASYONMYN.RecordSource = "SELECT TACALISANKAYDI.*, TRADYASYON2020.* FROM TACALISANKAYDI LEFT JOIN TRADYASYON2020 ON TACALISANKAYDI.KIMNO = TRADYASYON2020.KIMNO;"
DoCmd.Close acForm, "FRADYASYONMYN", acSaveYes
DoCmd.OpenForm "FRADYASYONMYN", , , "TACALISANKAYDI.KIMNO=" & Me.LstKayitSorg
DoCmd.Close acForm, Me.Name
'******
Dim x As Integer
For x = 1 To 3
DoCmd.OpenReport "RAPRADMYNSYF" & x, acViewDesign
Reports("RAPRADMYNSYF" & x).RecordSource = "SRGRD20"
DoCmd.Close acReport, "RAPRADMYNSYF" & x, acSaveYes
Next x

ElseIf Me.AclRMynSec = "2019" Then

DoCmd.OpenForm "FRADYASYONMYN", acDesign
Forms!FRADYASYONMYN.RecordSource = "SELECT TACALISANKAYDI.*, TRADYASYON2019.* FROM TACALISANKAYDI LEFT JOIN TRADYASYON2019 ON TACALISANKAYDI.KIMNO = TRADYASYON2019.KIMNO;"
DoCmd.Close acForm, "FRADYASYONMYN", acSaveYes
DoCmd.OpenForm "FRADYASYONMYN", , , "TACALISANKAYDI.KIMNO=" & Me.LstKayitSorg
DoCmd.Close acForm, Me.Name

For x = 1 To 3
DoCmd.OpenReport "RAPRADMYNSYF" & x, acViewDesign
Reports("RAPRADMYNSYF" & x).RecordSource = "SRGRD19"
DoCmd.Close acReport, "RAPRADMYNSYF" & x, acSaveYes
Next x

End If
Bu kodları bir fonksiyon ile kısaltmanın yolu var mı? 2019 ve 2020 için form ve rapor kayıt kaynağını belirlediğim ifadeler, çalışıyor. Geriye dönük diğer yılları da alacak şekilde genişleteceğim. 
İyi çalışmalar.
Son Düzenleme: 06/06/2020, 23:10, Düzenleyen: mgunes.
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
Rapor Kayıt Kaynağı Değiştirme Vba - Yazar: mgunes - 04/06/2020, 10:17
RE: Rapor Kayıt Kaynağı Değiştirme Vba - Yazar: mgunes - 06/06/2020, 23:08
Task