message in these cases:
a) It's a new record (so there was no old value.)
b) No customer was specified previously (so the customer wasn't 'changed'.)
c) No customer is specified now. (You may or may not want to check this.)
d) The record was edited, but the customer wasn't changed (including leaving
it blank as it was before.)
Most of these have to do with handling Nulls. If you want to read further
about considering the 3 possible outcomes for any comparision (True, False,
or Null), see the last error addressed in this article:
Common Errors with Null
at:
http://allenbrowne.com/casu-12.html
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"franc sutherland" <fr**************@googlemail.comwrote in message
news:ce**********************************@p35g2000 prm.googlegroups.com...
On Nov 15, 2:31 am, "Allen Browne" <AllenBro...@SeeSig.Invalidwrote:
>Thanks for that. It worked a treat. However, I don't understand why
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim strMsg As String
Dim bWarn As Boolean
With Me.Customer_id
If .Value <.OldValue Then
bWarn = True
strMsg = strMsg & "Changed customer from " & .OldValue & " to "
& .Value." & vbCrLf
End If
End With
If bWarn And Not Cancel Then
If MsgBox(strMsg, vbOkCancel+vbQuestion, "Confirm change") <vbOk
Then
Cancel = True
Me.Undo
End If
End If
End Sub
the code I was using wasn't given the same outcome. Reading it
through, it seems to follow the same logical path. Is the new value
the same as the old value, if not, confirm action and then update or
undo. Can you explain, please?