setting focus to a subform textbox

  • Thread starter faapa via AccessMonster.com
  • Start date
F

faapa via AccessMonster.com

hi

jst a quick question

if im trying to set focus to a textbox in a subform - what code would i write?
i've tried:

..frm_performance_target_subform!Scenario_id.setfocus

however it doesnt work! it doesnt recognise Scenario Id (which is the textbox
i want to set focus to in the subform)
 
G

Guest

Hi

You need to do it in 2 stages
Go to the subform - Then go to the control

Try this

Private Sub Button_Click() - Or use AfterUpDate or whatever you want -

DoCmd.GoToControl "frm_performance_target_subform"
DoCmd.GoToControl "Scenario_id"

End Sub
 
F

faapa via AccessMonster.com

thanks - i got it to focus to the textbox in the subform however i cant type
anything in it now!! also, the focus also remains on the last textbox on the
mainform....

any more suggestions on what to do? its so confusing!
 
G

Guest

Hi Again

I think you'll find that lift itself is confusing.

Anyway :) Open the query that the form is based on - can you type
anything into that (if not then you need to alter your relationships in the
design grid).

Next if you "can add stuff to the query" check your subform properties to
ensure that you have the addition, edis, etc set to Yes.

Let me know if these sort out the problem.

About the focus staying on the main form. Can you post your code that you
have used to set the forcus to the subform. It may be of some help
 
F

faapa via AccessMonster.com

Hi Wayne

Thanks for your suggestions - i checked out thesubform properties and their
all ok, (can add/edit/delete = yes etc) and the query connection is fine..its
just getting the 'flow' of the form right

so far, i have a function that checks the validation errors on the parent
form, (so if the user enters data in one of the textboxes and not all, the
info isnt saved) i tried to add the subform textboxes into this function (so
if u dont type in data in the subform then all the data isnt saved) but it
didnt work becasue the function was on the form and not the subform (hp that
makes sense!) so my next step was to edit the beforeUpdate property in the
subform = i can get msgboxes to appear and set the focus to the the textbox i
want to add data too, but the user is still able to exit the page without
writing data!!

i was thinking about editing the code in OnCurrent property in the Parent
form however it doesnt accept
cancel = true

do you another piece of code that can replace this (not the user exit the
form) to be entered in the OnCurrent property?
 

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