Log inUsernamePassword
Log me on automatically each visit    
Register
Register
Log in to check your private messages
Log in to check your private messages
Visual Basic Forum for Visual Basic Programmers VB Forum Index » Database & Reporting

Post new topic   Reply to topic
how to search all in adodc
View previous topic :: View next topic  
Author Message
alexltkv
Regular


Joined: 08 Jul 2005
Posts: 61
Location: Iraq

PostPosted: Oct 1st, 2006 12:12 PM    Post subject: how to search all in adodc Reply with quote

Hello,
I'm using this code to search in the database by fax number
Code:

SearchX = InputBox("Enter The fax Number", "Searching")
Adodc1.Recordset.MoveFirst
Do Until Adodc1.Recordset.EOF Or FoundX 'loop all the database data and search the string
    If Adodc1.Recordset.Fields("fax") Like SearchX Then 'if the recordset is same
        FoundX = True
    Else 'if the recordset is not same than go to the next line
        Adodc1.Recordset.MoveNext
    End If
Loop

If FoundX = False Then 'if the sting didn't found, it will appear a msg and go back to the current data
    MsgBox "Record not found", vbInformation, "Database Function"
    Adodc1.Recordset.MoveFirst 
End If


now in the database there are more then one contact with the same fax number. I would like to display every contact with the same fax number in a datagrid how can I do this?
_________________
You're not a CYBERHOLIC... if you look for the Soup of the Day in the Format menu.
Back to top
View user's profile Send private message
dougthomas
Moderator


Joined: 27 Jul 2005
Posts: 271
Location: Essex, UK

PostPosted: Oct 5th, 2006 11:51 PM    Post subject: Reply with quote

Hi,

Simplest way would be to remove the 'Or FoundX' from the Do statement. You will then always search the entire recordset. Within the loop, when you find a match you will need to either display it then or save it somewhere. Perhaps in a dymanic array

Regards
Doug
_________________
If you can see the light at the end of the tunnel, it probably means there's a Train coming.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Visual Basic Forum for Visual Basic Programmers VB Forum Index » Database & Reporting All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Visual Basic Forum runs phpBB | Forum Template © iOptional
VB Resources | SSL | Visual Basic