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
Programmatically Setting Order By Property in a Three Level Report
Problem Creating MDE file
Receiving error when submitting data to SQL Server through asp.net vb
How to populate unbound controls on a continuous form in Access 2007
Exchange Migration - Exchange 2003 - Exchange 2007 - Old Hardware to New Hardware
DIR command to list directory contents to text file
Syntax for SQL subquery
Operation has timed out error while sending mail (above 2 MB) through C#.net
Exporting with TransferText and schema.ini
Save an Access Report as a PDF