Skip to main content

AccessTr.neT


Access' Te Class Module Oluşturma

Access' Te Class Module Oluşturma

#7
(23/07/2023, 14:30)feraz yazdı: Buda class sız alternatif arşivden.


Kod:
Option Compare Database

Private Sub Form_Load()

    Dim ctl As Control
    
    For Each ctl In Me.Controls
        Select Case ctl.ControlType
            Case acTextBox, acComboBox 'TextBox ve ComboBox icin
                If ctl.Tag = "degistiginde" Then
                    ctl.OnChange = "=Degisti([" & ctl.Name & "])"
                    ctl.OnGotFocus = "=ArdRenk([" & ctl.Name & "])"
                    ctl.OnLostFocus = "=ArdRenkCik([" & ctl.Name & "])"
                End If
            Case acCommandButton 'CommandButton ve TextBox ve ComboBox icin
                If ctl.Tag = "degistiginde" Then
                    ctl.OnGotFocus = "=ArdRenk([" & ctl.Name & "])"
                    ctl.OnLostFocus = "=ArdRenkCik([" & ctl.Name & "])"
                End If

        End Select
    Next ctl

End Sub

Public Function Degisti(ctl As Control) 'TextBox ve ComboBox icin
    Me.Metin0 = ctl.Text
End Function

Public Function ArdRenk(ctl As Control) 'TextBox ve ComboBox ve CommandButton icin
    ctl.BackColor = vbGreen
End Function

Public Function ArdRenkCik(ctl As Control) 'TextBox ve ComboBox ve CommandButton icin
    ctl.BackColor = vbWhite
End Function


teşekkürler Hocam
truhi, 29-09-2009 tarihinden beri AccessTr.neT üyesidir.
Cevapla
#8
(24/07/2023, 23:32)truhi yazdı:
(23/07/2023, 14:30)feraz yazdı: Buda class sız alternatif arşivden.


Kod:
Option Compare Database

Private Sub Form_Load()

    Dim ctl As Control
    
    For Each ctl In Me.Controls
        Select Case ctl.ControlType
            Case acTextBox, acComboBox 'TextBox ve ComboBox icin
                If ctl.Tag = "degistiginde" Then
                    ctl.OnChange = "=Degisti([" & ctl.Name & "])"
                    ctl.OnGotFocus = "=ArdRenk([" & ctl.Name & "])"
                    ctl.OnLostFocus = "=ArdRenkCik([" & ctl.Name & "])"
                End If
            Case acCommandButton 'CommandButton ve TextBox ve ComboBox icin
                If ctl.Tag = "degistiginde" Then
                    ctl.OnGotFocus = "=ArdRenk([" & ctl.Name & "])"
                    ctl.OnLostFocus = "=ArdRenkCik([" & ctl.Name & "])"
                End If

        End Select
    Next ctl

End Sub

Public Function Degisti(ctl As Control) 'TextBox ve ComboBox icin
    Me.Metin0 = ctl.Text
End Function

Public Function ArdRenk(ctl As Control) 'TextBox ve ComboBox ve CommandButton icin
    ctl.BackColor = vbGreen
End Function

Public Function ArdRenkCik(ctl As Control) 'TextBox ve ComboBox ve CommandButton icin
    ctl.BackColor = vbWhite
End Function


teşekkürler Hocam

Rica ederim.
Cevapla

Bir hesap oluşturun veya yorum yapmak için giriş yapın

Yorum yapmak için üye olmanız gerekiyor

ya da