Cardbox > Forums > Macros and Programming > "Quick Search Macro"
Quick Search Macro
A quick way of using Cardbox's powerful search capabilities. |
Posted By | Post |
---|---|
Jelly Belly | 25-Feb-2010 17:07 Firstly before somebody says "Cardbox already does this!", this Macro I believe, enhances the search function of Cardbox and is now used as a preference by our company. Maybe it might help you? Basically playing the Macro (mine is linked to a button) will bring up an Input box for your search. If you enter a word Cardbox will search all fields and has a wildcard at the end for example "JOHN*". If you leave a space and enter a second search Cardbox will automatically search again for the second item. for example "JOHN* PORTSMOUTH*" will find every instance of John living in Portsmouth. If no results are found a message box will appear and automatically take you back a level so all the Johns are found. You can enter up to 4 search parameters in one search. Obviously this will not suit every application and the normal select methods can be used. The Code..... Dim Qsearch,Word,NewSearch SelectionLevel=0 Qsearch = InputBox ("Enter Your Search","Quick search") If Qsearch = "" Then Halt Word = Split (Qsearch) ActiveWindow.Select "",(Word(0)) & "*" If RecordCount = 0 and SelectionLevel = 4 Then If RecordCount = 0 and SelectionLevel = 3 Then If RecordCount = 0 and SelectionLevel = 2 Then If RecordCount = 0 and SelectionLevel = 1 Then |
bert | 25-Feb-2010 23:46 It is also my experience that adding that type of things for many people (and me) Cardbox becomes more easy. Why so less people has discovered it yet? Regards |
Llewellyn | 17-Jun-2015 02:33 Firstly thanks for this macro! When I use the above macro as is, I always come up empty handed - I believe this may have to do with the way my database is set up. When I do a manual search, I also come up empty handed when I don't specifically Select "search record data" as the default is "search the database index". Any idea's as to where I can set "search record data" in the above code? Or when I can read up on this? Any pointers much appreciated. Thanks |
bert | 17-Jun-2015 12:07 It seems your database fields not have the property activated 'index automatic' or 'all'. |