Set Me.hiddentxt some value for Button on form txtdatabox exit eve

  • Thread starter Thread starter Hugh self taught
  • Start date Start date
H

Hugh self taught

Hi O' knowledgeable fundis,

I would like to place an indicator value in a hidden txt box on my form in
the "On Exit" event of a field so that I can know which button triggered the
exit. Is this possible as I can't seem to find a way.

Any method of recording that activity would be great.
 
You have to be a little more specific. You want to trigger an event on the on
exit of a textfield and want to know what triggered it? Probably the on exit
event i presume.

But if i want to know which button was pressed or which control did
something i record it using the me.activecontrol option for that. See if that
can set you up with what you'd like to achieve.

or describe in more detail what should be written in the hidden textbox
after which event will be triggered
 
Hi Maurice,

My form is a tabbed form with name & surname on the detail of the form with
other data on the tabs. I use the "on exit" of "Surname" to move the focus to
the 1st field on the 1st tab. I also have buttons on the form to perform
certain actions like save the record, add a new record etc.

My problem is when the focus is on "Surname" & I click one of those buttons,
then it's "on exit" triggers & my button's event code doesn't occur (only to
fire the "Surname" on exit event). What I want is to still be able to execute
the code of the button that was clicked.

Any help on achieving that will be awesome.
 
Hi Hugh,

That's a tricky situation. In this case the on exit will always win this
situation. If you do have a hidden textfield on your form you can fill this
with the value when a specific button gets focus by setting the code:

me.textbox=me.activecontrol.name

after that you can use the textbox value to check which button was pressed.
It's not a feasable solution so you might reconsider the on exit option for
surname. Maybe set a certain value in the hidden textbox of the form after
the on exit and persue your event triggering from that point on.
 
We must be on opposite sides of the world. You're awake now & I'm about to go
sleep.

Part of the problem is that the button only will get focus on the 2nd click
& the user will be terribly confused when nothing apparently happens on the
click.

The 1st click causes the "on exit" to fire moving focus to the next field so
the activecontrol.name before the click is "Surname" & after the click it's
the field to which the setfocus in the "on exit" event sent it.

I have to find some way of getting around this. I was hoping that I could
put something in the "on exit" that would indicate the button clicked & that
way I could know which code to execute.

Any thoughts or suggestions?
 
I don't have time to try it right now but what if I did something along the
lines of "Sendkeys" TAB value as the 1st line of code behind the button then
the code to execute? Would that be like 2 clicks & would it fire in that way?
 
hmm sendkeys is not really the way to go. This is one that should be avoided
if possible. I tried your scenario and i found that clicking once actually
first fired the on exit and then it triggered the button event. So the
problem lies in the fact that the on exit takes control first and then the
event of the on click takes over.

I'll try to figure something out by playing around with it. What is the
trigger you are trying to accomplish when exiting the surname? Opening a form
or concatenating a name or something else. What's the trigger for the button,
opening a form or...
 
Hi Maurice,

Sorry for taking so long to get back to you. Too many priorities on my end.

I want to allow the data capturer to be able to save at that point in case
they don't have all the rest of the data available. failing which I want to
allow them to "Undo" Cancel the new entry which is where I have my biggest
need. Other times it could be an update being done where a woman's surname
has changed & that's the field just updated & the user just clicks "save".

Most of the threads I've read on the forum refer to training the user to use
ESC twice but since the save / cancel options work from other text boxes they
would be totally confused by having to press ESC in some instances but not in
others.

If you're able to find a workaround I'd be over the moon.
 
Back
Top