search box on form for "contains"

iankerry

Registered User.
Local time
Today, 10:12
Joined
Aug 10, 2005
Messages
190
Hi

I have a continous form, and i am constantly right clicking and finding the "contains..." filter.

is there a way of having a box on my form, into which i can type a few letters and depending on which field my cursor was in, it does a "contains..." filter?

many thanks

i.
 
You should be able to use the Screen.PreviousControl to determine the last field visited. However one problem is a general textbox for the "Contains" or "Like" criteria would need to validate the type of data you are searching for. Lets say you were on a date field and then the user typed in Fred in the search box you would end up trying to search for a date called Fred! Also you need to employ the correct syntax when building your search string. I suggest you only do this for text type fields.

Just a push in the right direction.

David
 
thanks for the push David. can i beg your indulgence further?

I have been trying some things since i got your message. I should say i am only a beginner!

i added a textbox called search, then used an update event, but got a bit stuck.

i created a "stringwhat" expression which equal whatever is in the textbox, then tried a docmd apply filter with a where condition, but of course hit a brick wall.

to make it simpler to start the search box need only reference one of the fields at the moment. Because the deeper i delved the more complex. The fields, say the "film name" field, actually carried an ID number of a film. so if i typed mamma mia in the search box it will never find it as mamma mia is stored as 196. So i tried to reference the column of the combobox i was using.

sure enough the filmID.column(0) returns the actual film name.

BUT, this is a continuous form.

then i went into meltdown. Way over my head.

If it has got too complex, feel free to ignore. but if you can start me off in the right direction?

thanks
 

Users who are viewing this thread

Back
Top Bottom