Save

  • Thread starter Thread starter Bill
  • Start date Start date
B

Bill

Is there an example where to look and give me some ideas.

If you can provide me where to look an example or give me the example of
coding.

It would be much helpful to me.

Bill


*********************************

In the BeforeUpdate event procedure of the form, loop through the form's
Controls collection, and compare the Value of the bound controls their
OldValue.
 
Aircode to check all the text boxes and combos on your form:

Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim ctl As Control
Dim strMsg As String

For Each ctl In Me.Controls
With ctl
If .ContorlType = acTextBox Or .ControlType = acComboBox Then
If Len(.ControlSource) > 0 Then 'Not unbound
If Asc(.ControlSource) <> 61 Then 'Not bound to an
expression.
If .Value = .OldValue Then 'Not unchanged.
'do nothing
Else
strMsg = strMsg & .ControlSource & " was " & _
Nz(.OldValue, "Null") & "; now " & _
Nz(.Value, Null) & vbCrLf
End If
End If
End If
End If
End With
Next

If Len(strMsg) > 0 Then
strMsg = strMsg & vbCrLf & "Save these changes?"
If MsgBox(strMsg, vbOKCancel) <> vbOK Then
Cancel = True
End If
End If
Set ctl = Nothing
End Sub
 
Back
Top