471,579 Members | 1,985 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,579 software developers and data experts.

Search sub-form without writing exactly what is contained in query field

Hi there,
Is there a way of searching a sub-form (reading from a query) without
writing what is exactly contained in the query field.
For example if I had a 'Finance Manager' in the query but just wanted
to type 'Finance' in the text box to search or 'Admin Manager' in the
query and just wanted to search 'Admin' in the text box.
How would I do it so when I searched just 'Admin' or 'Finance', 'Admin
Manager' and 'Finance Manager' appeared as part of the results?
Any help is much appreciated.
Thanks for your time.
R.

Mar 27 '06 #1
2 1279
On 27 Mar 2006 05:44:53 -0800, vi*********@googlemail.com wrote:
Hi there,
Is there a way of searching a sub-form (reading from a query) without
writing what is exactly contained in the query field.
For example if I had a 'Finance Manager' in the query but just wanted
to type 'Finance' in the text box to search or 'Admin Manager' in the
query and just wanted to search 'Admin' in the text box.
How would I do it so when I searched just 'Admin' or 'Finance', 'Admin
Manager' and 'Finance Manager' appeared as part of the results?


Use the wildcard characters in your query:

SELECT * FROM SomeTable WHERE SomeField='*Finance*'

If you're doing this in an ADO recordset, you may need to use the % char:

SELECT * FROM SomeTable WHERE SomeField='%Finance%'

And if you want to capture user input, say from a textbox named ctlSearch:

SELECT * FROM SomeTable WHERE SomeField='*" & Me.ctlSearch & "*'

Scott McDaniel
scott@takemeout_infotrakker.com
www.infotrakker.com
Mar 27 '06 #2
Hi Scott,
Thanks a lot for your reply.
Will this work if I already have some criteria in some fields of my
query (in design view)?
Also, will this work if say I type 'Admin' and 'Finance' in the same
text box but for different searches?
So for instance, firstly I want to search all staff who have 'finance'
in their job title and then after this I want to search for all staff
with 'admin' in their job title and then one with 'IT' in their job
title.
Sorry if its quite simple, I'm fairly new to access so still grasping
all of the elements!
Thanks again.
R.
Scott McDaniel wrote:
On 27 Mar 2006 05:44:53 -0800, vi*********@googlemail.com wrote:
Hi there,
Is there a way of searching a sub-form (reading from a query) without
writing what is exactly contained in the query field.
For example if I had a 'Finance Manager' in the query but just wanted
to type 'Finance' in the text box to search or 'Admin Manager' in the
query and just wanted to search 'Admin' in the text box.
How would I do it so when I searched just 'Admin' or 'Finance', 'Admin
Manager' and 'Finance Manager' appeared as part of the results?


Use the wildcard characters in your query:

SELECT * FROM SomeTable WHERE SomeField='*Finance*'

If you're doing this in an ADO recordset, you may need to use the % char:

SELECT * FROM SomeTable WHERE SomeField='%Finance%'

And if you want to capture user input, say from a textbox named ctlSearch:

SELECT * FROM SomeTable WHERE SomeField='*" & Me.ctlSearch & "*'

Scott McDaniel
scott@takemeout_infotrakker.com
www.infotrakker.com


Mar 27 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Vamsee Krishna Gomatam | last post: by
3 posts views Thread by Animal | last post: by
reply views Thread by Hriday | last post: by
1 post views Thread by calhoun | last post: by
reply views Thread by XIAOLAOHU | last post: by
reply views Thread by Vinnie | last post: by
1 post views Thread by lumer26 | last post: by
reply views Thread by lumer26 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.