Hi
I have a form to add records to a table.
On the form I have several controls I wish to force to be edited (they are calculated and stored depending on user input) before the user can move onto the next record.
I had command buttons which 99% of users have user and had no issues until someone discovered the Ctrl+ shortcut to insert new record.
Since this passes the checks I embedded into the command buttons it allows then to bypass the psuedo validation.
I initially looked at disabling the shortcut, however I found a post from Allen Browne Suggesting against this and using the form update property.
My issue is simple yet annoying
The before update fires after the first control is edited, i wish to try to stop it until the user attempt to goto a new record.
Enclosed below is my vb.
Text47 is a calculated field, it checks to see whether 3 concatenated fields already and prevent that 'work order' being duplicated.
Hopefully someone can save my little grey cells
Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If [Text47] = "Error" Then
MsgBox "The work order you are trying to create already exists please change the snow, sheet or line, or cancel creating a new work order", vbOKOnly, "Work order already exists"
GoTo exit_sub:
End If
If IsNull([SNOW]) Or IsNull([Sheet]) Or IsNull([Line]) Or IsNull(Task) Or IsNull([Planned pulse]) Or IsNull([Task Type]) Or ([Sheet] <> 0 And [Predicted AC Hrs] = 0 And [Predicted AV Hrs] = 0) Then
MsgBox "You must input data into all fields marked with a red label", vbOKOnly, "Not All required data entered"
GoTo exit_sub:
End If
exit_sub:
End Sub