Hi,
I need to send keys to escape 2 times. How can I achieve this? Here's my situation:
On my main form, I have a subform which displays 3 fields and the form is set up as continuous.
On beforeInsert of the subform my code checks for empty fields (required) on my main form.
If it finds a field that can't be null, then my code displays a message.
When the user clicks ok, I send keys to escape to cancel the record from the subform.
The problem is it will allow me to continue to enter data into the subform with the required fields on the main form left null. It doesn't give me the message again. Here's what I have:
I need to send keys to escape 2 times. How can I achieve this? Here's my situation:
On my main form, I have a subform which displays 3 fields and the form is set up as continuous.
On beforeInsert of the subform my code checks for empty fields (required) on my main form.
If it finds a field that can't be null, then my code displays a message.
When the user clicks ok, I send keys to escape to cancel the record from the subform.
The problem is it will allow me to continue to enter data into the subform with the required fields on the main form left null. It doesn't give me the message again. Here's what I have:
Code:
'check required fields
If IsNull(frm![txtPriorities]) Then
MsgBox "Please enter the total of priority activities.", vbExclamation, "Daily Briefs"
If ctlCurrentControl.Name = "hyperlink_title" Or ctlCurrentControl.Name = "hyperlink_address" Or ctlCurrentControl.Name = "news_details" Then
SendKeys "{ESC}"
SendKeys "{ESC}"
Else
End If
Exit Function