 |
| View previous topic :: View next topic |
| Author |
Message |
alexltkv Regular
Joined: 08 Jul 2005 Posts: 61 Location: Iraq
|
Posted: Oct 1st, 2006 12:12 PM Post subject: how to search all in adodc |
|
|
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 |
|
dougthomas Moderator
Joined: 27 Jul 2005 Posts: 271 Location: Essex, UK
|
Posted: Oct 5th, 2006 11:51 PM Post subject: |
|
|
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 |
|
|
|
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
|
|