Tabbing in Subform

T

tsquared1518

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.
 
D

Daryl S

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
 
D

Daryl S

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?
 
T

tsquared1518

That worked. Thanks for your help.

Daryl S said:
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 said:
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?
 

Ask a Question

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.

Ask a Question

Top