Microsoft
Software
Hardware
Network
Question : Before Update Event in Combo Box Cancel event
This is my code and attached are examples of errors I get.
Statement "Cancel = True" is causing the problem.
Error1 happens only in this example, but Error2 happens in all my combo boxes on various forms throughout the project where I have Cancel = True in the Before Update Event.
Private Sub Client_ID_BeforeUpdate(Can
cel As Integer)
If Nz(DLookup("[Client ID]", "[tblAttendance]", "[Session ID] = " & _
Nz(Forms![frmSessionAttend
ance].Form
.Recordset
.[Session ID], 0) & _
"AND [Client ID] = " & Nz(Me.[Client ID], 0)), 0) <> 0 Then
MsgBox "This client already exists on this list."
Me.Client_ID.Undo
Cancel = True
End If
End Sub
Answer : Before Update Event in Combo Box Cancel event
If you cancel the before update event of a control then you also need to cancel the form before update event and handle the form undo event. See
www.thenelson.name/#Report
FormTricks
, "Check for required items" for details on how to do it.
Random Solutions
How to resolve Blue Screen with errorcode 0x80899707 on SBS 2003?
How do I configure my DHCP server correctly in this network?
How to tel an MFC app the location of an external DLL?
'Day' is a type and cannot be used as an expression
Bridge Network Connections
Move Mailbox from Exchange 2007 SP2 to Exchange 2010
which is worse - missing index or unused indexes
JET SQL - Merging fields from two tables into one, skipping duplicates
gpedit.msc not found in Windows 7 Home Premium
Populate Textbox with all query returns on a field