You should validate the last record and make sure it is filled before
allowing it to be saved. The easiest way is to add:
Is Not Null to the property sheet of every control on the form that you
require to be filled, but if they skip the controls entirely, you'll need
something like:
Public Sub CheckIt(frm As Form)
On Error Resume Next
Dim ctl As Control
For Each ctl In frm.Controls
With ctl
If .ControlType = acTextBox Or .ControlType = acCombobox Then
MsgBox "You MUST fill in" & ctl.Name, vbOKOnly, "Missing data"
End If
End With
Next ctl
Set ctl = Nothing
Set frm = Nothing
End Sub
Then call CheckIt in the BeforeUpdate event of your form.
In the BeforeUpdate event of the form, write some code like (untested):
Sub Form_BeforeUpdate(Cancel As Integer)
If Len(Me.[Time of Exit] & vbNullString) < 1 Then
MsgBox "You must Fill In the the Time of Exit", vbOKOnly, "Data Missing"
Me.[Time of Exit].SetFocus
Cancel = True
End If
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.