Save

B

Bill

Thanks, will it work Access 97 ??

Bill

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

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Require fields and refresh 14
Unwanted Message Box 2
Event Fires Twice 2
Data validation 2
Confirm data change on close 21
Assign a blank date value 6
Validation Rule Code Help 3
Checking Data Change on Close 3

Top