Need Code to tab out of subform

R

Ron Weaver

I have just made some cosmetic changes to my subform. To get the effects of
the change, I had to change my views from Database to Continuous Forms. My
problem is: When I am done entering Equipment in the subform, I can't tab out
of it to go on to an item on the main form like I could before in Database
view. I'm sure there is some code I can put in that last field of the
subform, or somewhere, but I can't seem to make anything work. I am new to
this. Thanks for any help.
 
H

Hung.cao

Ron said:
I have just made some cosmetic changes to my subform. To get the effects of
the change, I had to change my views from Database to Continuous Forms. My
problem is: When I am done entering Equipment in the subform, I can't tab out
of it to go on to an item on the main form like I could before in Database
view. I'm sure there is some code I can put in that last field of the
subform, or somewhere, but I can't seem to make anything work. I am new to
this. Thanks for any help.

In the last field on the subform, you may want to write a code on the
exist property of this field something like the below.

Me![mainfom]![thefield you want to go to].setfocus

THat should point you to the field you want when the last field on the
subform exist.

GL.
 
H

Hung.cao

Ron said:
I have just made some cosmetic changes to my subform. To get the effects of
the change, I had to change my views from Database to Continuous Forms. My
problem is: When I am done entering Equipment in the subform, I can't tab out
of it to go on to an item on the main form like I could before in Database
view. I'm sure there is some code I can put in that last field of the
subform, or somewhere, but I can't seem to make anything work. I am new to
this. Thanks for any help.

In the last field on the subform, you may want to write a code on the
exist property of this field something like the below.

Me![mainfom]![name of the field you want to go to].setfocus

THat should point you to the field you want when the last field on the
subform exist.

GL.
 
T

tina

you could add code to the Exit event procedure of the last control (in the
tab order) of the subform to SetFocus back to a control in the main form, as

Me.Parent!MainFormControlName.SetFocus

replace MainFormControlName with the correct name of the control on the main
form that you want the cursor to "land" in.

but, if you do this, the user won't be able to easily add multiple records
to the subform at one time, because the code will keep kicking the focus out
of the subform into the main form. as an alternative, you might want to set
a hot key to the main form control the user will want to move to - by
"underlining" a letter in the control label's caption. you do this by adding
an ampersand (&) immediately before the letter in the Caption property. for
example, the following caption property in a control's label, as

&First Name

will underline the F in Form view, and the user can jump to that control by
pressing Shift+f.

having set up a hot key, you'd need to train your users to use it to get
back to the main form. to an experienced data entry operator, this method
quickly becomes second nature, and is much quicker than using the mouse to
click into the desired field.

hth


Ron said:
I have just made some cosmetic changes to my subform. To get the effects of
the change, I had to change my views from Database to Continuous Forms. My
problem is: When I am done entering Equipment in the subform, I can't tab out
of it to go on to an item on the main form like I could before in Database
view. I'm sure there is some code I can put in that last field of the
subform, or somewhere, but I can't seem to make anything work. I am new to
this. Thanks for any help.

In the last field on the subform, you may want to write a code on the
exist property of this field something like the below.

Me![mainfom]![thefield you want to go to].setfocus

THat should point you to the field you want when the last field on the
subform exist.

GL.
 
R

Ron Weaver

Thanks to you and Tina.
This gets me out of the subform ok, but before I'm through entering items.
After I'm through, I need to go to the next record in the subform and just
tab across to the last field. If it's blank or "0", then it takes me out of
the subform. I hope this makes sense. I didn't explain it very well before.
Ron said:
I have just made some cosmetic changes to my subform. To get the effects of
the change, I had to change my views from Database to Continuous Forms. My
problem is: When I am done entering Equipment in the subform, I can't tab out
of it to go on to an item on the main form like I could before in Database
view. I'm sure there is some code I can put in that last field of the
subform, or somewhere, but I can't seem to make anything work. I am new to
this. Thanks for any help.

In the last field on the subform, you may want to write a code on the
exist property of this field something like the below.

Me![mainfom]![name of the field you want to go to].setfocus

THat should point you to the field you want when the last field on the
subform exist.

GL.
 
T

tina

well, here's another alternative that may work for you. in the subform, in
the last control's Exit event procedure, add the following code, as

If Me.NewRecord Then Me.Parent!ControlName.SetFocus

the above goes all on one line in the procedure, regardless of how the
newreader may wrap it here. replace ControlName with the correct name of the
control on the main form that you want the cursor to "land" in.

hth


Ron Weaver said:
Thanks to you and Tina.
This gets me out of the subform ok, but before I'm through entering items.
After I'm through, I need to go to the next record in the subform and just
tab across to the last field. If it's blank or "0", then it takes me out of
the subform. I hope this makes sense. I didn't explain it very well before.
Ron said:
I have just made some cosmetic changes to my subform. To get the effects of
the change, I had to change my views from Database to Continuous Forms. My
problem is: When I am done entering Equipment in the subform, I can't tab out
of it to go on to an item on the main form like I could before in Database
view. I'm sure there is some code I can put in that last field of the
subform, or somewhere, but I can't seem to make anything work. I am new to
this. Thanks for any help.

In the last field on the subform, you may want to write a code on the
exist property of this field something like the below.

Me![mainfom]![name of the field you want to go to].setfocus

THat should point you to the field you want when the last field on the
subform exist.

GL.
 
R

Ron Weaver

That works perfectly.
Thanks Tina

tina said:
well, here's another alternative that may work for you. in the subform, in
the last control's Exit event procedure, add the following code, as

If Me.NewRecord Then Me.Parent!ControlName.SetFocus

the above goes all on one line in the procedure, regardless of how the
newreader may wrap it here. replace ControlName with the correct name of the
control on the main form that you want the cursor to "land" in.

hth


Ron Weaver said:
Thanks to you and Tina.
This gets me out of the subform ok, but before I'm through entering items.
After I'm through, I need to go to the next record in the subform and just
tab across to the last field. If it's blank or "0", then it takes me out of
the subform. I hope this makes sense. I didn't explain it very well before.
Ron Weaver wrote:
I have just made some cosmetic changes to my subform. To get the effects of
the change, I had to change my views from Database to Continuous Forms. My
problem is: When I am done entering Equipment in the subform, I can't tab out
of it to go on to an item on the main form like I could before in Database
view. I'm sure there is some code I can put in that last field of the
subform, or somewhere, but I can't seem to make anything work. I am new to
this. Thanks for any help.

In the last field on the subform, you may want to write a code on the
exist property of this field something like the below.

Me![mainfom]![name of the field you want to go to].setfocus

THat should point you to the field you want when the last field on the
subform exist.

GL.
 
T

tina

you're welcome :)


Ron Weaver said:
That works perfectly.
Thanks Tina

tina said:
well, here's another alternative that may work for you. in the subform, in
the last control's Exit event procedure, add the following code, as

If Me.NewRecord Then Me.Parent!ControlName.SetFocus

the above goes all on one line in the procedure, regardless of how the
newreader may wrap it here. replace ControlName with the correct name of the
control on the main form that you want the cursor to "land" in.

hth


Ron Weaver said:
Thanks to you and Tina.
This gets me out of the subform ok, but before I'm through entering items.
After I'm through, I need to go to the next record in the subform and just
tab across to the last field. If it's blank or "0", then it takes me
out
of
the subform. I hope this makes sense. I didn't explain it very well before.
:


Ron Weaver wrote:
I have just made some cosmetic changes to my subform. To get the effects of
the change, I had to change my views from Database to Continuous Forms. My
problem is: When I am done entering Equipment in the subform, I
can't
tab out
of it to go on to an item on the main form like I could before in Database
view. I'm sure there is some code I can put in that last field of the
subform, or somewhere, but I can't seem to make anything work. I
am
new to
this. Thanks for any help.

In the last field on the subform, you may want to write a code on the
exist property of this field something like the below.

Me![mainfom]![name of the field you want to go to].setfocus

THat should point you to the field you want when the last field on the
subform exist.

GL.
 
Top