Tabbing in Subform

  • Thread starter Thread starter tsquared1518
  • Start date Start date
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.
 
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
 
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?
 
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?
 
Back
Top