SetFocus to a control on a subform - continuous form

G

Guest

Hi

I can use your help in getting the cursor back to a control on a continuous
Subform. The sub has two controls, Inv# and Amount. I use the AfterUpdate
on the Amount control to test whether the payment amount equals the invoice
amount. If the two are not the same, I prompt the user and would like to
return the cursor to the Amount control on the last line in this multi-line
subform.

Thanks
 
R

ruralguy via AccessMonster.com

Here's the syntax you need in the 2 step process:

Me.SubFormControl.SetFocus '-- Set Focus to the
SubFormControl 1st
Me.SubFormControl.Form!ControlName.SetFocus '-- Now set Focus to the control
on SubForm
DoCmd.RunCommand acCmdRecordsGoToLast '-- And move to the new
record

The SubFormControl is the control that is displaying the SubForm on the
MainForm. It is the control that has the LinkChild/MasterFields properties
 
G

Guest

Hmmm, tricky but have you tried something like:

When wrong...

docmd.runcommand accmdRecordsGotoPrevious
me.amount.setfocus (where amount is your fieldname).

Working on a multiline subform it's very difficult to check where the user
comes from and goes to.

hth
 

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