944,117 Members | Top Members by Rank

Ad:
May 15th, 2007
0

ADODC Search code

Expand Post »
hi im just starting to design a database using adodc but I have a problem...

can someone give me tip on how to create a search code for ADODC... thx in advance
Similar Threads
Reputation Points: 10
Solved Threads: 1
Newbie Poster
cybuster is offline Offline
3 posts
since May 2007
May 17th, 2007
0

Re: ADODC Search code

I don't get it. Don't you have google?

In 1 second I got this result.
Look here: http://hamilton.bell.ac.uk/swdev1/notes_pp1_5.doc

I just searched on: +adodc +recordset +select
You can also try to seach on: +adodc +recordset +find
Reputation Points: 10
Solved Threads: 5
Junior Poster in Training
PVBert is offline Offline
60 posts
since Mar 2007
May 17th, 2007
-1

Re: ADODC Search code

Click to Expand / Collapse  Quote originally posted by cybuster ...
hi im just starting to design a database using adodc but I have a problem...

can someone give me tip on how to create a search code for ADODC... thx in advance
Try the following code.
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. adcBrowser.Recordset.Find txtSearchHdr.Text & " like '" & txtSearch & "_'", , adSearchForward
  2. 'adcBrowser is the name of your ADODC
  3. 'txtSearchHdr.Text is your recordset field
  4. 'txtSearch is your search criteria
if you want to search for a hypothetic recordset field sname for "surname"
begining with "dav" then txtSearchHdr.Text is sname
and txtSearch is dav

adSearchForward or adSearchBackward can be used.
Last edited by jamello; May 17th, 2007 at 7:06 am.
Reputation Points: 215
Solved Threads: 6
Posting Whiz in Training
jamello is offline Offline
219 posts
since Oct 2006
May 19th, 2007
0

Re: ADODC Search code

re as recordset
dim x as string
x=inputbox("enter the name please :")
re.findfirst"name=' " & x & " ' "
if re.nomatch then
msgbox "the name You Entered not found"
end if
Reputation Points: 6
Solved Threads: 0
Newbie Poster
ahmed elweshahy is offline Offline
17 posts
since Apr 2007
May 20th, 2007
0

Re: ADODC Search code

The .nomatch property doesn't exist in ADO.
Reputation Points: 10
Solved Threads: 5
Junior Poster in Training
PVBert is offline Offline
60 posts
since Mar 2007
Jun 8th, 2007
0

Re: ADODC Search code

Remember that you can only search on 1 field with the FindFirst method.

The following code will not work;

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. rs.findfirst "NAME=" & 'NAME' & " AND POBOX=" & '2300 PD'
Reputation Points: 10
Solved Threads: 0
Newbie Poster
mivc is offline Offline
2 posts
since Jun 2007
Jun 8th, 2007
0

Re: ADODC Search code

findfirst doesn't exist at all, so even searching on one field won't go
you can you select statements and use:

vb Syntax (Toggle Plain Text)
  1. Dim cn As ADODB.Connection
  2. Dim cmd As ADODB.Command
  3. Dim rs As ADODB.Recordset
  4.  
  5. Set cn = New ADODB.Connection
  6. Set cmd = New ADODB.Command
  7. Set rs = New ADODB.Recordset
  8.  
  9. ' Open the Connection object
  10. cmd.ActiveConnection = cn
  11.  
  12. cmd.CommandText = "select "
  13. cmd.Execute
  14.  
  15. ' Open a Recordset object on the new table.
  16. cmd.CommandText = "SELECT * FROM YOURTABLENAME WHERE YOURFIELDNAME = 'YOURVALUE' "
  17.  
  18. ' "SELECT * FROM YOURTABLENAME WHERE YOURFIELDNAME = 'YOURVALUE' AND YOUROTHERFIELDNAME = 'ANOTHERVALUE' "
  19.  
  20. Set rs = cmd.Execute()
  21.  
  22. rs.Close
  23. cn.Close
Reputation Points: 10
Solved Threads: 5
Junior Poster in Training
PVBert is offline Offline
60 posts
since Mar 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Printer Object
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: VB Macro for use across 2 Excel workbooks





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC