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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

addressing a text box on a sub form

Status
Not open for further replies.

jeffmoore

Programmer
Aug 29, 2003
301
US
Hi
I have a continuous sub form with a text box. I need to put a value into this text box. once the value is inthe txt box the form adds that record and displays a new txtbox below the original for new data.
How do I move focus or address this new txtbox????
I have no problems getting to the first text box, it's getting to the new one that is the problem.

ps all this is being done from a seperate form.
heres a little code

note all the sendkey stuff is to TAB me to then next txtbox... it may be working but my set focus is dropping me back to my startting place

btw the focus stays on my (record line) even if there are 4 records showing in the sub form ... I cant get it to jump to the next record..

Set rs = Me.Recordset
rs.MoveFirst
While Not rs.EOF
Forms!frm_training_matrix![qry_training_details_sub subform]!txt_TrainingType = rs!TrainingType
Forms!frm_training_matrix![qry_training_details_sub subform]!txt_TrainingType.SetFocus
SendKeys "{tab}", True
SendKeys "{tab}", True
SendKeys "{tab}", True
SendKeys "{tab}", True
SendKeys "{tab}", True
SendKeys "{tab}", True
SendKeys "{tab}", True
SendKeys "{tab}", True
SendKeys "{tab}", True

rs.MoveNext
Wend

TIA
Jeff
 
Hallo,

To move between records use the GoToRecord bits of RunCommand. To set a focus on a Control, use .SetFocus method. If the control is on a subform you must to SubformControl.SetFocus first

- Frink
 
You may also want to check the setting in the form properties on the "Other" tab. The Cycle property should be set to all records. If it is set to current record, the tab key will only cycle through the fields in the current record.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top