Wrox Programmer Forums
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 15th, 2006, 05:55 AM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 155
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to leehambly
Default

Svenni,

Dunno where to start, without re-designing your db, you are going to struggle.

You need a bit of code which will cycle through the 20 tables. You then need a bit of code to search for your text string in the given field, or possibly another piece of code which cycles through the fields in the tables and then a piece of code that does the actual searching.

Q: Given that you have 20 tables, what do you want to happen when it finds a match? Does each table have its own form? Would you expect a different action from one table to the next?

Q: Why have you got 20 tables? If we could sort that out, we should be able to provide a fairly simple solution, but I reckon this is a far bigger issue.

I'm gonna suggest using the Ctrl-F shortcut when in the column on the table you want to search, this will give you a "Find" dialog box. Don't take it the wrong way if you already know about it, just realised I hadn't mentioned it already!
 
Old December 15th, 2006, 06:14 AM
Authorized User
 
Join Date: Dec 2006
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hmmm, I know this database is flawed in it's way :P
We are a construction company and we have diffrent tables for diffrent towns and projects conserning those towns :)
But if you could make something for me that searches through just one table it would be wonderfull :)
"the people who work here are to lazy to actualy open the table and lick ctrl + f" :P


 
Old December 15th, 2006, 06:39 AM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 155
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to leehambly
Default

Sorry to be a bit piecemeal on this:

1. So, given that your tables have a project number in them, the data is already identifyable by Project number, so only the town to worry about.
2. If you add the town to your table, could you then union all the tables together into one big table? If so, do it.
3. Now you have one big table with all your data on, you would obviously need to change whatever queries you already have set up and then add in the town field to ensure that the same data is still identified in your queries... this is all besides the point, but I would feel bad if I didnt mention it!
4. Cool, now we can search your data table for your search string, and we don't have to worry about what action to take at the end of the search, since there is only one table.
5. Build a query, use your table and add the fields you want to see in your results, you dont have to add all of them.
6. Add in the field you want to search and in the Criteria "area?" in the query, type:

Like "*" & [Type the phrase of letters you are looking for:] & "*"

7. Now run the query... you should get a dialog box with the text "Type the phrase of letters you are looking for:" and a space for you to enter the phrase... enter something you know will be in the field, for testing.

8. That should sort you out. You can do this without adding all the tables together, as MMcDonal mentioned. Tell your users to use the query whenever they want to find a specific project, town, name, etc...

Hope it helps, but you really need to sort the data out too.

Lee
 
Old December 15th, 2006, 06:57 AM
Authorized User
 
Join Date: Dec 2006
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hmmmm, even is I use
"*" & [Type the phrase of letters you are looking for:] & "*"
too search inside just one table all it gives me is an empty colum :/

Field: Fieldname
Table: Tablename
Sort: Ascending
Show: ^^ ofc
Criteria:"*" & [Type the phrase of letters you are looking for:] & "*"

then I have 2 other colums just diplaying other info for the search outcome :S

any thoughs ?


 
Old December 15th, 2006, 06:59 AM
Authorized User
 
Join Date: Dec 2006
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hmmm, seems like if I just type in the projects name into "Criteria" field it findsit right away, but not with
"*" & [Type the phrase of letters you are looking for:] & "*"


 
Old December 15th, 2006, 07:03 AM
Authorized User
 
Join Date: Dec 2006
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

fixed it ^^

[Type the phrase of letters you are looking for:]

just this works wonders :P

 
Old December 15th, 2006, 07:08 AM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 155
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to leehambly
Default

It is not:

"*" & [Type the phrase of letters you are looking for:] & "*"

it is:

Like "*" & [Type the phrase of letters you are looking for:] & "*"

Using just:

[Type the phrase of letters you are looking for:]

will return records with the entire field matched, whereas with Like "*"" etc you will get any records with a partial match.

Up to you which is more suitable.

Lee
 
Old December 15th, 2006, 07:16 AM
Authorized User
 
Join Date: Dec 2006
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

arf, ok last question :P

Is it possible to search one field with [Type the phrase of letters you are looking for:]
and if it is "ok"'d blank it will ask for the next one :O

 
Old December 15th, 2006, 07:22 AM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 155
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to leehambly
Default

what do you mean by "ok'd"?
 
Old December 15th, 2006, 07:25 AM
Authorized User
 
Join Date: Dec 2006
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hehe, I was reading over what I wrote and i'm gona try to epxlain this a litle better :P

so, first I prompt for a word to search for in "field1"

is there anyway I can make the query prompt you for multiple fields and only return those who actualy have something writen in them.

or make it prompt multible and then search for the first on who you dont turn in blank ?






Similar Threads
Thread Thread Starter Forum Replies Last Post
Search button doesn't search Access DB cbones Visual Studio 2008 1 October 27th, 2008 07:36 PM
File Search / Indexing Search with .net 2.0 maulik77 ASP.NET 1.0 and 1.1 Basics 2 March 15th, 2007 12:45 AM
Regarding Search Tool in ASP Page.Urgent Help Need anand_asv Classic ASP Basics 2 February 7th, 2006 05:03 AM
Search Engine for Full-text Search Kala ASP.NET 1.0 and 1.1 Professional 2 August 29th, 2004 02:16 AM
Search engine that search through local drive! wenzation Classic ASP Basics 0 August 26th, 2003 09:15 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.