use of active control

C

cbnewman

All,

I am trying to use a generic search button for one of my forms. I
would like the user to be able to enter search information into one of
several fields (name, medical record number, location, etc) and have a
single search button (the way I have it implemented right now has a
separate button for each searchable field).

I tried using activecontrol, but as soon as the user clicks on the
button, the focus changes to the button. What's the best way to figure
out where the focus was immediately prior to the button click? Does
each control have a "dirty" property? I could at least iterate through
the searchable controls and generate a filter string if one of them
changed, i suppose, but I'm looking for a more elegant solution.

Thanks,
--b
 
A

Albert D. Kallal

does it really matter what textbox they were in?

I mean, they might enter location, and name....don't you want to search on
both?

Or, simply use the after update event of the text box in question (it will
not fire unless they make changes).

So, in the after update event of the 4 text boxes, simply call your search
routine...

if ONLY the current text box is to be used for the search...then go

strTextBox = me.ActiveContorl.Name
Call Mysearch

In your seach routine, you can code for the particlar text box.....
 

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