Group:  Microsoft Access ยป microsoft.public.access.formscoding
Thread: Error number: 2108 You must save the field before you .....

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

Error number: 2108 You must save the field before you .....
rmcompute 02.09.2006 16:06:01
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


Re: Error number: 2108 You must save the field before you .....
"J. Goddard" <jrgoddard[ at ]NO_cyberus_SPAM.ca> 02.09.2006 20:30:49
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:
[Quoted Text]
> 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
>
>

Re: Error number: 2108 You must save the field before you .....
rmcompute 03.09.2006 22:45:01
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
> >
> >
>
>

Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net