R
rudwan
i have a form , i want during typing or reviewing data <
to aske wethere user to save what he change ,
i design this code :
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim m As Integer
Dim ctl As Control
Dim intnewrec As Integer
intnewrec = Me.NewRecord
If intnewrec = True Then
MsgBox " you insert a new record "
Else
For Each ctl In Me.Controls
If ctl.ControlType = acTextBox Or
ctl.ControlType = acComboBox Then
If ctl.OldValue <> ctl.Value Then
m = InputBox(ctl.ControlName & " value
already changed Enter your password to save ?")
If m = 1 Then
Cancel = False
Else
Cancel = True
ctl.Undo
End If
End If
End If
Next ctl
End If
End Sub
it works ok but for some fields , if i changed some fields
it allert me , in other controlls it changed without allert
but notice , some controlls are text , the other are number
to aske wethere user to save what he change ,
i design this code :
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim m As Integer
Dim ctl As Control
Dim intnewrec As Integer
intnewrec = Me.NewRecord
If intnewrec = True Then
MsgBox " you insert a new record "
Else
For Each ctl In Me.Controls
If ctl.ControlType = acTextBox Or
ctl.ControlType = acComboBox Then
If ctl.OldValue <> ctl.Value Then
m = InputBox(ctl.ControlName & " value
already changed Enter your password to save ?")
If m = 1 Then
Cancel = False
Else
Cancel = True
ctl.Undo
End If
End If
End If
Next ctl
End If
End Sub
it works ok but for some fields , if i changed some fields
it allert me , in other controlls it changed without allert
but notice , some controlls are text , the other are number