Option Compare Database
Option Explicit
Global EskiVeriler As VBA.Collection
'www.accesstr.net
Public Function EskiVerileriSakla(GFormadi As String)
On Error Resume Next
Dim GKontrol As Access.Control
Dim GAltformKontrol As Access.Control
Dim GForm As Access.Form
Set EskiVeriler = New VBA.Collection
Set GForm = Forms(GFormadi)
For Each GKontrol In GForm.Controls
If TypeName(GKontrol) = "SubForm" Then
For Each GAltformKontrol In GKontrol.Form.Controls
If GAltformKontrol.ControlType = acTextBox And GAltformKontrol.Tag = 1 Then
EskiVeriler.Add GAltformKontrol.Value & "", GAltformKontrol.Name
End If
Next
Else
If GKontrol.ControlType = acTextBox And GKontrol.Tag = 1 Then
EskiVeriler.Add GKontrol.Value & "", GKontrol.Name
End If
End If
Next
Set GKontrol = Nothing
End Function
Public Function EskiVeriAktar(GFormadi As String)
On Error Resume Next
Dim GKontrol As Access.Control
Dim GAltformKontrol As Access.Control
Dim GForm As Access.Form
Set GForm = Forms(GFormadi)
For Each GKontrol In GForm.Controls
If TypeName(GKontrol) = "SubForm" Then
For Each GAltformKontrol In GKontrol.Form.Controls
If GAltformKontrol.ControlType = acTextBox And GAltformKontrol.Tag = 1 Then
GAltformKontrol.Value = EskiVeriler.Item(GAltformKontrol.Name)
End If
Next
Else
If GKontrol.ControlType = acTextBox And GKontrol.Tag = 1 Then
GKontrol.Value = EskiVeriler.Item(GKontrol.Name)
End If
End If
Next
End Function
Veri değiştiğinde geri alınacak metin kutularının im özelliğine 1 yazıldı.
Formun geçerli olduğunda olayına
Call EskiVerileriSakla(Me.Name)
Kodu eklendi.
Geri Al veya kapat butonunun tıklandığında olayına
Call EskiVeriAktar(Me.Name)
Kodu eklendi.