Creating a google-like search bar

urfriend

Registered User.
Local time
Today, 17:18
Joined
Oct 26, 2012
Messages
21
Hello everyone,

I wonder if by any chance it is possible to create a search bar that scans the entire database- or lemme say the fields i assigned to such search bar- that can be put in the switchboard or so.
According to my level of understanding of access, this should be a query.
However, is it possible to make it appear like a search bar that could be placed where I want it; in this case in the switchboard??
Does it require a certain code or something?

Appreciate your help and thanks in advance...
 
Perhaps the sample here does the sort of thing you are looking for.
 
Grrrrreat

Thanks a lot guys...

That was really helpful...
 
I design something like this into my databases all the time.

The below code is activated on the key down event - specifically the return key.

I have a text box called text 2 on a form and a user types into that. Beneath that there is a list box with 1/2 a dozen fields. The user types something in and then when he wishes to search through the list box presses return.

The below code is triggered on return.

Essentially it goes away and runs a query on the side and looks for *text2* in any of the fields.

The list box then shortens the listed records to all those that apply and the user can click directly on interested one or redo the search. Clicking on a record will take them direct to the record.

Code:
    If KeyCode = vbKeyReturn Then
    
    Dim strSQL As String
    Dim txtSearchString As String
    
    Text2.SetFocus
    
    txtSearchString = Me!Text2.Text

    strSQL = "SELECT T001Site.ID, T001Site.Sitename, T001Site.Street, T001Site.Town, T001Site.Postcode, T001Site.LocalPlanReference AS [Local Plan], T001Site.AuditReference AS Audit, T010PlanningApplications.ApplicationNo, T001Site.OfficialName AS [Official Name], T010PlanningApplications.Applicant, T010PlanningApplications.LegalCaseReference AS Legal, T001Site.SalesName "
    strSQL = strSQL & "FROM (T001Site LEFT JOIN T035Council ON T001Site.CouncilJurisdiction = T035Council.PKID) LEFT JOIN T010PlanningApplications ON T001Site.ID = T010PlanningApplications.IDLink "
    strSQL = strSQL & "WHERE (((T001Site.ID) Like '*" & txtSearchString & "*') OR ((T010PlanningApplications.Applicant) Like '*" & txtSearchString & "*')) OR (((T001Site.Sitename) Like '*" & txtSearchString & "*')) OR (((T001Site.Street) Like '*" & txtSearchString & "*')) OR (((T001Site.Town) Like '*" & txtSearchString & "*')) OR (((T001Site.Postcode) Like '*" & txtSearchString & "*')) OR (((T001Site.LocalPlanReference) Like '*" & txtSearchString & "*')) OR (((T001Site.AuditReference) Like '*" & txtSearchString & "*')) OR (((T010PlanningApplications.ApplicationNo) Like '*" & txtSearchString & "*')) OR (((T001Site.OfficialName) Like '*" & txtSearchString & "*')) OR (((T010PlanningApplications.LegalCaseReference) Like '*" & txtSearchString & "*')) OR (((T001Site.SalesName) Like '*" & txtSearchString & "*')) ORDER BY T001Site.Sitename,T010PlanningApplications.ApplicationRegistrationDate DESC"

    Me.List0.RowSource = strSQL
    Me.List0.Requery
    
    Else
    
    End If
 

Users who are viewing this thread

Back
Top Bottom