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
SBS 2003 Best Practise Analyser indicates 2 failures
Draw a line in CImage object
Create Pie Chart in Excel 2007
Delphi to VB.NET
Load progress bar C#, asp.net
Why do I get an access denied error when I try to view the files inside the folder redirect folders?
What is the code to link a cell to a file?
Extract OLE Object from an MS Access database
FLICKERING LISTBOX - MS ACCESS 2003
Access SQL Query Error 3079: Specified field could refer to more than one table listed