Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

search with the first Word

Status
Not open for further replies.

JKingdom

Programmer
May 9, 2004
141
AE
I have a field in the database called "Tender Name" from this field I'm trying to get the first word "entered by the user in a text field" based on this entered word the search criteria will get the right tender name and display it in a report ... below I'm using crystal reports to display the searched criteria method into a report.

Example:

Tender Name = 'Maintenance School project"
Search Word = "Maintenance"
Output:
Must display all records that start with Maintenance.


//////////////////////////////////

Private Sub GoldButton1_Click()
'Dim Msg As String
Dim St As String
'Msg = InputBox("Enter the Section name", "Search by Section")
If txtProj.Text = "" Then Exit Sub
frmContProjects.Hide
With frmContProjects.Cr
.Connect = "DSN=TenderDb;UID=admin;PWD=sharmila"
.ReportFileName = App.Path & "\reports\Followup.rpt"
.SelectionFormula = "{proj_follow.tender_name} = '" & txtProj.Text & "%'"
.WindowState = crptMaximized
.Action = 1
.SelectionFormula = ""
End With
End Sub
 
Could not understand what is your problem. Can you tell what problem u r faceing?
 
Hi,

I this will return the first word of a textbox as a variable named stri

Code:
        Dim stri As String
        Dim i As Integer

        i = InStr(TextBox1.Text, " ")

        If i <> 0 Then
            stri = Left(TextBox1.Text, i - 1)
        Else
            stri = TextBox1.Text
        End If

Hope this helps

Harleyquinn

---------------------------------
For tsunami relief donations
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top