fong.yang@martecgroup.com wrote in
news:1145123085.841185.66550@i40g2000cwc.googlegro ups.com:
[color=blue]
> I have four textbox listed on the form(DaysOfOperation,
> HoursStart, HoursFinish, PrimaryOther) along with one combo
> box (Primary Business).
> I want all of the them to require an entry before moving on
> to the
> next record. This is what I have so far in the Before Update
> event of the form:
>
> Private Sub Form_BeforeUpdate(Cancel As Integer)
> Me!UpdatedOn = Now()
> If Me!PrimaryBusiness.Value = "Other" _
> And IsNull(Me!PrimaryOther.Value) Then
> MsgBox "Must Enter Type Of Business!!"
> Me!PrimaryOther.SetFocus
> Cancel = True 'Important; this stops the record from being
> saved.
> End If
> End Sub
>
> This works to require an entry in PrimaryOther, but it still
> allows the other 3 textboxes to be blank. How can I get the
> other 3 to be required as well. Thanks.
>[/color]
just add three similar tests (one for each field.
The second would be
If IsNull(Me!DaysOfOperation.Value) Then
MsgBox "Must Enter Days of operation!!"
Me!DaysOfOperation.SetFocus
Cancel = True
End If
The next test would start....
If IsNull(Me!HoursStart.Value) Then
.......
......
You can figure them out.
--
Bob Quintal
PA is y I've altered my email address.