From: tsquared1518 on
I have a main form, with a subform on it. I want to program one of the text
boxes on the subform, so that if it is left empty, it will tab to the close
form button, instead of going through the entire subform again. I am having
trouble with the syntax and which event to place it in. Can anyone help me
out? Thanks! My text box is named Seal Profile, and the cmd button is named
Close Form, if that will help.
From: Daryl S on
tsquared1518 -

In your LostFocus event of the text box [Seal Profile], add this code
(assuming the control name for the Close Form button is Close Form):

If IsNull(Me.[Seal Profile]) then
Me.[Close Form].Set Focus
End If

--
Daryl S


"tsquared1518" wrote:

> I have a main form, with a subform on it. I want to program one of the text
> boxes on the subform, so that if it is left empty, it will tab to the close
> form button, instead of going through the entire subform again. I am having
> trouble with the syntax and which event to place it in. Can anyone help me
> out? Thanks! My text box is named Seal Profile, and the cmd button is named
> Close Form, if that will help.
From: Daryl S on
Tsquared1518 -

If your [Close Form] button is on the main form, then do this:

If IsNull(Me.[Seal Profile]) then
Parent.[Close Form].Set Focus
End If

I don't know why you have a pipe character in your error message - do you
have a pipe character in your code somewhere?

--
Daryl S


"tsquared1518" wrote:

> Thanks Daryl. I tried that, and am getting this runtime error
> 2465...Microsoft Office Access cant find the field '|' referred to in your
> expression. Could this be due to the close form button being on the main form?
From: tsquared1518 on
That worked. Thanks for your help.

"Daryl S" wrote:

> Tsquared1518 -
>
> If your [Close Form] button is on the main form, then do this:
>
> If IsNull(Me.[Seal Profile]) then
> Parent.[Close Form].Set Focus
> End If
>
> I don't know why you have a pipe character in your error message - do you
> have a pipe character in your code somewhere?
>
> --
> Daryl S
>
>
> "tsquared1518" wrote:
>
> > Thanks Daryl. I tried that, and am getting this runtime error
> > 2465...Microsoft Office Access cant find the field '|' referred to in your
> > expression. Could this be due to the close form button being on the main form?