Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Question about buttons and fields

Status
Not open for further replies.

Soulbait

MIS
Mar 12, 2003
43
US
Probably really simple question, but its something I have no idea about.

After clicking a button (the button adds a record) How can you tell it to automagically go back to the desired field?

And on that question, if you press a button in a sub form how much difference is code is needed to make it go back to a field in the main form?

Thanks in advance

Soulbait
"Despite the cost of living, its still quite popular"
 
[red]After clicking a button (the button adds a record) How can you tell it to automagically go back to the desired field?[/red]

To set the focus to any particular control, use the "objecname.SETFOCUS method, e.g.

Me!EmployeeID.SETFOCUS


[red]if you press a button in a sub form how much difference is code is needed to make it go back to a field in the main form?[/red]

Not a whole hell of a lot. See the answer to #1 above.

The big difference is making sure you have the correct form object reference. A subform is in a control on the main form. Thus, you can set the focus to the subform-in-the-control itself,

me!SubformControlName.SETFOCUS

or or you can set it to a specific control on the subform itself:

Me!SubFormControlName.FORM!PartNumber.SETFOCUS

(The above assumes that PARTNUMBER is on the subform.)

To go from the subform to a control on the main form, just use

ME!Controlname.SETFOCUS, as in the first question.

Jim


Me? Ambivalent? Well, yes and no....
Another free Access forum:
More Access stuff at
 
Thanks that did the trick

Soulbait
"Despite the cost of living, its still quite popular"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top