Setfocus question

  • Thread starter Thread starter duy944t
  • Start date Start date
D

duy944t

Hi,

On a form, when field A is changed, I update field B automatically by
Setfocus to field B, and then assign it with another value. This is
handled in the field A AfterUpdate method. After updating field B, I
want the form to continue normally. For example, setting the focus to
where I clicked last. Or in the case that I click that next record
button, the form should show the next record. Is there a way to do
this? Currently, when I click on the next record button, the form stays
at the current record. I then have to click it again to move to next
record.

Thanks,
Tony
 
On a form, when field A is changed, I update field B automatically by
Setfocus to field B, and then assign it with another value. This is
handled in the field A AfterUpdate method. After updating field B, I
want the form to continue normally. For example, setting the focus to
where I clicked last. Or in the case that I click that next record
button, the form should show the next record. Is there a way to do
this? Currently, when I click on the next record button, the form stays
at the current record. I then have to click it again to move to next
record.


There is no reason to set the focus to a control to just set
its value. Get rid of the SetFocus line and everything
should proceed normally.
 
Thanks Marshall. I have always thought that a control has to gain focus
before it can be modified. Which I also thought was weird. Thanks again.
 
Thanks Marshall. I have always thought that a control has to gain focus
before it can be modified. Which I also thought was weird. Thanks again.


That is true if you are working with the .Text property.
However, it is a very rare situation where you would want to
manipulate Access's .Text property when the control did not
already have the focus.

VB controls don't have a .Value property and they use the
..Text property all the time. A lot of VB programmers get
stuck in that mindset and when they try to carry it over to
Access controls, they get into the set focus problem.
 

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

Back
Top