How to build a website-like search?

M3lvn

Registered User.
Local time
Today, 01:57
Joined
Mar 3, 2009
Messages
22
Hello,

What im trying to build is a search that goes through the whole database and all tables.

The output will be on a form by which the found items are shown, but not all at once. Only the first item is displayed and the rest can be seen by using the navigation button (first, back, next and last, see pic below).


attachment.php


in# = indicator#
art = article
oms = discription


What Ive done so far:
I checked out this website (http://www.everythingaccess.com/tutorials.asp?ID=Build-a-search-criteria-form) from Allen Browne.

I put a line for testing: txtOms = strWhere
and I get the error in the pic.
I think that the difference between Allen's example database and mine is that his form and some textfields/comboboxes are bound to the table tblClient. I want mine to be completely unbound.

First question (for now):
How do I get the code to search all the tables?


If there is more information needed, feel free to ask.


Regards,
Melvin
 

Attachments

  • pic1.jpg
    pic1.jpg
    38.3 KB · Views: 267
you may want to study this one! maybe it could help you out.

Im currently studying the example database.
It is not exactly what I had in mind, but I have a good feeling it will do nicely. I really like the doubleclick feature to view the record in detail and the option to search with more than 1 keyword. Thanks alot!

Ok, now down to the grinding:
I see that the columnheaders are also taken into the listbox search results. Is there a way to ake it look exactly like the table? The headers are above and in the body are only record attributes.

Also, Im experimenting with some other tables and I get a type mismatch error when viewing in detail along these codelines:

Code:
Case 1:
     intIdentifierValue = lstList.Column(intI, varItm)

Edit:
Editted to narrow it down to the exact line.
 
Last edited:
Here is the the sample database with my table imported in it, which is giving errors.

To reproduce the problem use the following keywords:
- leeftijd (means age)
- dienstplicht (means duty)

Only the found records starting with the tablename (tbl_DIENSTPLICHTWET) are good. The rest of the found records gives errors.
 

Attachments

After some searching and researching Ive come across some code:

Code:
Dim strF As String
If not isnull(Me.Text0) Then strF = _
"[TableFld0] = '" & Me.Text0 & "' And "
If not isnull(Me.Text1) Then strF = strF & _
"[TableFld1] = '" & Me.Text1 & "' And "
If not isnull(Me.Text2) Then strF = strF & _
"[TableFld2] = '" & Me.Text2 & "' And "
.....and etc. then remove the word And at end of filter
If strF > "" THen strF = Left(strF,len(strF)-5)
'now filter or open a form/report
Forms!FormToFilter.Form.Filter = strF
Forms!FormToFilter.Form.Filter = True
or
DOcmd.OpenReport "YourReport",,,strF


I think I have the following problems not getting it working:
- there is code missing that tells the srtF to filter all the tables (except the system tables) and
- Im having trouble processing the filtered string result into a form or something visible.

This code does differ from the other post.

I found some other programs that work like the one from Allen Browne.
But the problem is that they search 1 table only or 1 query.
How do I get the string to apply to the whole database?

Some help would be appreciated.
 

Users who are viewing this thread

Back
Top Bottom