473,480 Members | 4,939 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to make a search engine in a form

I will make a form which will search the database (just like google
interface) that will look/match for the exact name in the records of a
given fieldname. Any suggestions on how to make the code?
Nov 13 '05 #1
9 20254
Christopher Koh wrote:
I will make a form which will search the database (just like google
interface) that will look/match for the exact name in the records of a
given fieldname. Any suggestions on how to make the code?


Create a form with the fields for input. Have a button to start the
search and another to exit. With the search button, open up the
property sheet and create a proc in Events for the OnClick event. Then
create a filter string. Ex:

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


Nov 13 '05 #2
thanks salad, can you just input some explanations or input the comments
again thanks
Salad <oi*@vinegar.com> wrote in message news:<9R*******************@newsread1.news.pas.ear thlink.net>...
Christopher Koh wrote:
I will make a form which will search the database (just like google
interface) that will look/match for the exact name in the records of a
given fieldname. Any suggestions on how to make the code?


Create a form with the fields for input. Have a button to start the
search and another to exit. With the search button, open up the
property sheet and create a proc in Events for the OnClick event. Then
create a filter string. Ex:

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

Nov 13 '05 #3
I would just like to followup, my output is in tabular form so it has
many field rows.Can you suggest what code i should write so that it
would just fill in the tab form thanks
Salad <oi*@vinegar.com> wrote in message news:<9R*******************@newsread1.news.pas.ear thlink.net>...
Christopher Koh wrote:
I will make a form which will search the database (just like google
interface) that will look/match for the exact name in the records of a
given fieldname. Any suggestions on how to make the code?


Create a form with the fields for input. Have a button to start the
search and another to exit. With the search button, open up the
property sheet and create a proc in Events for the OnClick event. Then
create a filter string. Ex:

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

Nov 13 '05 #4
I was just wondering how come there are a lot of textfields like
me.text0,me.text1 when i only have one textfield search engine

Salad <oi*@vinegar.com> wrote in message news:<9R*******************@newsread1.news.pas.ear thlink.net>...
Christopher Koh wrote:
I will make a form which will search the database (just like google
interface) that will look/match for the exact name in the records of a
given fieldname. Any suggestions on how to make the code?


Create a form with the fields for input. Have a button to start the
search and another to exit. With the search button, open up the
property sheet and create a proc in Events for the OnClick event. Then
create a filter string. Ex:

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

Nov 13 '05 #5
Christopher Koh wrote:
I was just wondering how come there are a lot of textfields like
me.text0,me.text1 when i only have one textfield search engine
I was descibing a method I use.

Are you refering to my use of me.Text0...1 etc? I suppose you are.

Take a look at advanced search in google.

Are you searching/filtering only on 1 field?

This is turning into a complex problem. You should know how to parse
out values in a string and you know what field you want to search.
Database tables consist of rows and columns. DO you know what you are
searching on or is it any table and any field?

Regarding a tab form. What does that mean? Does that mean your tabs
have individual subforms? Does your form have a recordsource?

If the search finds a record in some table for some field what do you
want it to do? Do you want to open a form, close a form, tell the user
a record was found, display a list of records that match?

Maybe you can tell us what you want to do besides create a google interface.

Salad <oi*@vinegar.com> wrote in message news:<9R*******************@newsread1.news.pas.ear thlink.net>...
Christopher Koh wrote:

I will make a form which will search the database (just like google
interface) that will look/match for the exact name in the records of a
given fieldname. Any suggestions on how to make the code?


Create a form with the fields for input. Have a button to start the
search and another to exit. With the search button, open up the
property sheet and create a proc in Events for the OnClick event. Then
create a filter string. Ex:

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


Nov 13 '05 #6
No, i am not using a subform. My form uses the return results of a
query in a tabform in the detail section. I just found out that you
can use the binoculars on the menu to find the searched word in the
tabular form then highlights it, it also has a find next.
This was my intention. But instead of using this , I want another way
thru VB editor in which the user inputs what he wants to search on the
textbox, then he clicks on the cmdgo button to look for the word in
the tabularform then highlights it, it also has a findnext

Salad <oi*@vinegar.com> wrote in message news:<i7*****************@newsread2.news.pas.earth link.net>...
Christopher Koh wrote:
I was just wondering how come there are a lot of textfields like
me.text0,me.text1 when i only have one textfield search engine


I was descibing a method I use.

Are you refering to my use of me.Text0...1 etc? I suppose you are.

Take a look at advanced search in google.

Are you searching/filtering only on 1 field?

This is turning into a complex problem. You should know how to parse
out values in a string and you know what field you want to search.
Database tables consist of rows and columns. DO you know what you are
searching on or is it any table and any field?

Regarding a tab form. What does that mean? Does that mean your tabs
have individual subforms? Does your form have a recordsource?

If the search finds a record in some table for some field what do you
want it to do? Do you want to open a form, close a form, tell the user
a record was found, display a list of records that match?

Maybe you can tell us what you want to do besides create a google interface.

Salad <oi*@vinegar.com> wrote in message news:<9R*******************@newsread1.news.pas.ear thlink.net>...
Christopher Koh wrote:
I will make a form which will search the database (just like google
interface) that will look/match for the exact name in the records of a
given fieldname. Any suggestions on how to make the code?

Create a form with the fields for input. Have a button to start the
search and another to exit. With the search button, open up the
property sheet and create a proc in Events for the OnClick event. Then
create a filter string. Ex:

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

Nov 13 '05 #7
Christopher Koh wrote:
No, i am not using a subform. My form uses the return results of a
query in a tabform in the detail section. I just found out that you
can use the binoculars on the menu to find the searched word in the
tabular form then highlights it, it also has a find next.
This was my intention. But instead of using this , I want another way
thru VB editor in which the user inputs what he wants to search on the
textbox, then he clicks on the cmdgo button to look for the word in
the tabularform then highlights it, it also has a findnext


When you said "Tabular form" I thought you meant a form with tabs on them.

I have two methods I'll talk about.

I call your type of form a log form and my log forms are "continuous"
forms, not datasheet. I'm basically displaying a list of records in a
table filtered and sorted the way I want. Above each column I put a
text field in the form header. When a person enters a value in that
field above that column, I clear out any other values in the other
search fields (I use the Tag property to determine which fields to
clear). I associate each column with a field. I then create a search
string from it and store it to a public variable. When the person
presses Enter or Tab, it searches for that field. If it finds it, it
moves to that record and sets focus. If the F3 key is pressed, it
searches for the next record. It's a pretty generic form.

The second method uses a form/subform. The Main form has 2 combo
fields; a combo box and a search field. The subform is a datasheet.
When I call the form, I pass the name of the calling form. Based on the
calling form I change the recordsource of the subform. The combo box is
updated and display a list of all columns in the datasheet. The person
then selects the field to search for in the combo and enters the value
to search for. When enter or tab is pressed it searches for the record
for a matching value for the column field selected in the combo. If
found, it moves to that record.

I set the dbl-Click on the records to present single record forms for
the record found.

That's what I do/use.

Nov 13 '05 #8
Salad, i think your first method suits my intention, can you give me
the vb edit code for it so that i can study it, thanks Salad
Salad <oi*@vinegar.com> wrote in message news:<93*****************@newsread2.news.pas.earth link.net>...
Christopher Koh wrote:
No, i am not using a subform. My form uses the return results of a
query in a tabform in the detail section. I just found out that you
can use the binoculars on the menu to find the searched word in the
tabular form then highlights it, it also has a find next.
This was my intention. But instead of using this , I want another way
thru VB editor in which the user inputs what he wants to search on the
textbox, then he clicks on the cmdgo button to look for the word in
the tabularform then highlights it, it also has a findnext


When you said "Tabular form" I thought you meant a form with tabs on them.

I have two methods I'll talk about.

I call your type of form a log form and my log forms are "continuous"
forms, not datasheet. I'm basically displaying a list of records in a
table filtered and sorted the way I want. Above each column I put a
text field in the form header. When a person enters a value in that
field above that column, I clear out any other values in the other
search fields (I use the Tag property to determine which fields to
clear). I associate each column with a field. I then create a search
string from it and store it to a public variable. When the person
presses Enter or Tab, it searches for that field. If it finds it, it
moves to that record and sets focus. If the F3 key is pressed, it
searches for the next record. It's a pretty generic form.

The second method uses a form/subform. The Main form has 2 combo
fields; a combo box and a search field. The subform is a datasheet.
When I call the form, I pass the name of the calling form. Based on the
calling form I change the recordsource of the subform. The combo box is
updated and display a list of all columns in the datasheet. The person
then selects the field to search for in the combo and enters the value
to search for. When enter or tab is pressed it searches for the record
for a matching value for the column field selected in the combo. If
found, it moves to that record.

I set the dbl-Click on the records to present single record forms for
the record found.

That's what I do/use.

Nov 13 '05 #9
I wonder if the page on this link will help you. Take a look at:
http://www.utteraccess.com/forums/sh...b=5&o=&fpart=1

PC
Nov 13 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1811
by: jlrodilla | last post by:
hi all, i´m doing a search engine using python for the spider and php to make a web for the search. The Database i have choosen is postgreSQL. Do you think it is a good choosen? Any suggestion? ...
11
4179
by: Petre Huile | last post by:
I have designed a site for a client, but they have hired an internet marketing person to incrase their search engine ranking and traffic. He wants to put extra-large fonts on every page which will...
3
2639
by: hazly | last post by:
I'm very new in the web technology and need advice on search engine. I want to develop a portal using PHP and MySQL on Linux. Need to know on the following features : 1. search engine that could...
4
2154
by: MDW | last post by:
Posted this on another board, but evidently it was off-topic there...hope you folks will be able to provide some guidance. I've been working on a Web site for a business (my first non-personal...
1
1621
by: Sheau Wei | last post by:
Below is my search engine code. I realize that the function was very limitied because i cannot searching the "NamaPealatan"(name of tools) compatible to the either categories Operasi or Balai or...
3
2200
by: Sheau Wei | last post by:
This is the search engine code that i create, but it was error and didnt come out the result. Cn u help me to check what wrong with my code? Thanks <Table cellspacing=1 cellPadding=1...
19
2236
by: bb nicole | last post by:
Below is my search engine for job portal which jobseeker can find the job through quick search. But it cant work... Is it mysql query got problem?? Thanx.. Interface <html> <head> <title>UMS...
2
1692
by: jamesmoore | last post by:
Hi, I have a job board and I am unsure of how to make a search form like other job boards so people can chose their needs then click search to search the posts on a webpage to then show the posts...
0
7040
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7041
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6736
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
6908
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5331
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4478
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
2994
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1299
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
178
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.