Dirty Event

14 May

From:    “Sofyan Efendi” <sofyan@madinah.cc>
Date:    Fri, 18 Aug 2006 15:00:28 +0700

Event Dirty terjadi saat isi dari form atau text box atau combo box berubah. Event ini terjadi pula saat kita berpindah dari page satu ke page lainnya dalam suatu tab control. Syntax:

Private Sub Form_Dirty(Cancel As Integer)

Penjelasan:

– Cancel: Jika diisi True maka akan meng-cancel event ini.

Urutan event ini adalah:

KeyDown > KeyPress > BeforeInsert > Dirty > KeyUp

Contoh:

Private Sub Form_Dirty()
If Me.Dirty Then
Me!btnUndo.Enabled = True ‘ Enable button.
Else
Me!btnUndo.Enabled = False ‘ Disable button.
End If
End Sub

Sub btnUndo_Click( )
Dim ctlC As Control
‘ For each control.
For Each ctlC in Me.Controls
If ctlC.ControlType = acTextBox Then
‘ Restore Old Value.
ctlC.Value = ctlC.OldValue
End If
Next ctlC
End Sub

Wassalaamu’alaikum Warahmatullahi Wabarakatuh,
Sofyan Efendi
– AccessWeb <http://www35.websamba.com/accessweb&gt;
– OPI-Homepage <http://www.geocities.com/opi1978&gt;

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: