borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (excel,foxprow to access)Next Topic (ado connectivity) New Topic New Poll Post Reply
AndreaVB Forum : Database : need help in data display
Poster Message
achek76
Level: Graduate

Registered: 28-01-2005
Posts: 9

icon need help in data display

how search and to display all data with refer to your search key in same field

tq in advance

06-02-2005 at 10:09 AM
View Profile Send Email to User Show All Posts | Quote Reply
Goran
Level: Moderator

Registered: 16-05-2002
Posts: 1681
icon Re: need help in data display

didnt understand anything.. are you using ADO/DAO, with data control or recordset objects... Place some code of yours (that is relevant to this subject) and point to where you are stuck...

____________________________
If you find the answer helpful, please mark this topic as solved.

06-02-2005 at 04:05 PM
View Profile Send Email to User Show All Posts | Quote Reply
achek76
Level: Graduate

Registered: 28-01-2005
Posts: 9
icon Re: need help in data display

how can i may possible to search and find datarecord in m.access using adodb and display it in listview.

the search term is will display any record witch match the search text ( just like using find in m/word ) for example iam search using key word " rahman " and my record only have "abd rahman " but still able to found "abd rahman " using "rahman"
(using ado record set)
thanks

####
Private Sub Command1_Click()
Dim strSQl As String
Dim litem As ListItem

'if there is nothing to search for then exit
If Text1.Text = "" Then
    Exit Sub
End If

ListView2.ListItems.Clear


'make the search
        strSQl = "SELECT * FROM surat"
        strSQl = strSQl & " WHERE tajuk surat LIKE '*" & Text1.Text & "*'"

        
'show the found records
    
    Dim ts As ADODB.Recordset

Set ts = New ADODB.Recordset
ts.Open "SELECT * FROM surat", "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=C:\Program Files\E- file management\fail.mdb"

ts.open"(strSQL)"

    If Not (ts.BOF And ts.EOF) Then
        Do While Not ts.EOF
            'List1.AddItem rs.Fields(1).Value
            
        Set litem = ListView2.ListItems.Add(, , ts.Fields(1).Value)
        litem.SubItems(1) = ts.Fields(2).Value
        litem.SubItems(2) = ts.Fields(8).Value
        litem.SubItems(3) = ts.Fields(3).Value
        litem.SubItems(4) = ts.Fields(5).Value
        litem.SubItems(5) = ts.Fields(6).Value
        litem.SubItems(6) = ts.Fields(7).Value
        
        ts.MoveNext
        Loop
    End If
'close the recordset
    ts.Close
    
End Sub

11-02-2005 at 12:50 PM
View Profile Send Email to User Show All Posts | Quote Reply
Goran
Level: Moderator

Registered: 16-05-2002
Posts: 1681
icon Re: need help in data display

Try

ts.open strSQL

instead of

ts.open"(strSQL)"


____________________________
If you find the answer helpful, please mark this topic as solved.

11-02-2005 at 05:00 PM
View Profile Send Email to User Show All Posts | Quote Reply
achek76
Level: Graduate

Registered: 28-01-2005
Posts: 9
icon Re: need help in data display

there another error
" one or more require value not set"

15-02-2005 at 03:11 PM
View Profile Send Email to User Show All Posts | Quote Reply
Goran
Level: Moderator

Registered: 16-05-2002
Posts: 1681
icon Re: need help in data display

quote:
strSQl = "SELECT * FROM surat"
        strSQl = strSQl & " WHERE tajuk surat LIKE '*" & Text1.Text & "*'"


If tajuk surat is the name of the field then you need to put it between the brackets, since field name has two words

strSQl = "SELECT * FROM surat"
        strSQl = strSQl & " WHERE [tajuk surat] LIKE '*" & Text1.Text & "*'"


____________________________
If you find the answer helpful, please mark this topic as solved.
16-02-2005 at 01:43 AM
View Profile Send Email to User Show All Posts | Quote Reply
achek76
Level: Graduate

Registered: 28-01-2005
Posts: 9
icon Re: need help in data display

THERE IS STILL ERROR
ERROR
VALUE NOT SET

OR ELSE
DO YOU HAVE ANY IDEA HOW MAKE SEARCH  IN RECORD SET BY WORD ( JUST LIKE YOU USING FIND FUNCTION IN EXEL )

19-02-2005 at 05:48 PM
View Profile Send Email to User Show All Posts | Quote Reply
Goran
Level: Moderator

Registered: 16-05-2002
Posts: 1681
icon Re: need help in data display

Well, then you are using incorrect names of table\field. Check if

surat = table name
tajuk surat - field name that exists in surat table

After you execute a query and fill recordset with data, then you can use Find method to search for some string value.

[Edited by Goran on 20-02-2005 at 01:45 AM GMT]

____________________________
If you find the answer helpful, please mark this topic as solved.

20-02-2005 at 12:42 AM
View Profile Send Email to User Show All Posts | Quote Reply
achek76
Level: Graduate

Registered: 28-01-2005
Posts: 9
icon Re: need help in data display

yes surat is table name
and tajuk surat is valid field name [tajuk surat]

23-02-2005 at 12:45 PM
View Profile Send Email to User Show All Posts | Quote Reply
steve_w
Level: Moderator


Registered: 18-04-2003
Posts: 1156
icon Re: need help in data display

Which line is giving you that error please? and also you may want to change you like to '%" & Text1.Text & "%'"

Steve  

23-02-2005 at 01:23 PM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : Database : need help in data display
Previous Topic (excel,foxprow to access)Next Topic (ado connectivity) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder