It worked. Thank you.
"J. Goddard" wrote:
[Quoted Text] > Try taking the SetFocus method out - you are already on the HRNum > control, and setting Cancel to non-zero prevents you from leaving the > control. > > Hope this helps. > > John > > > rmcompute wrote: > > I received the following message: > > > > Error number: 2108 You must save the field before you execute the > > GotoControl action, the GoToConrol method or the SetFocus method. > > > > The form contains a combo box, HRNum, with the Limit to list property set to > > No. > > There is a sub HRNum_BeforeUpdate which contains the following code to test > > for a missing HR Number. I know that the Set Focus is causing the error, > > however, when I used a text field instead of a combo box there was no error > > and how could I "save the field" as it states in the error. > > > > Private Sub HRNum_BeforeUpdate(Cancel As Integer) > > > > If IsNull(Me.HRnum) Then > > Me.HRnum.Undo > > Me.HRnum.SetFocus > > Cancel = MsgBox("You must enter an HR number.", vbCritical, "Data > > Validation Failure") > > End If > > > > > >
|