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 (Opening Database for Exclusive Access)Next Topic (DataGrid Problem -- Urgent) New Topic New Poll Post Reply
AndreaVB Forum : Database : Searching
Poster Message
ab10
Level: Guest


icon Searching

Hi,
  i would appriciate if anyone could help me a.s.a.p, it would help alot.

i have a datagrid and an adodc, i would like to type in a search criteria in a text box and click search. i would like to search my access database by name wether i type just 'a' or 'aaron'. then once the results are display i would like to be able to double click on the result i would like to view and then the results form shows the reults i have chosen.

the part where you click on the row and view the record isn't that important yet but would help.

if you can please send the code so all i have to change is the name of database etc. because i am finding this very hard to catch.

please email me on  ab141188@hotmail.com

thank you

06-11-2002 at 05:13 PM
| Quote Reply
noycez
Level: VB Guru


Registered: 14-10-2002
Posts: 79
icon Re: Searching

Private Sub cmdSearch_Click()

With mRec
If .RecordCount <> 0 Then
   'move next if not End of File
   If Not .EOF Then
      .MoveNext
   Else
      .MoveFirst
   End If
  
  'take note of the '*', this is a wildcharacter
  'so that is you search 'Mag' it will search all records that has a 'Mag' on it

  .Find "Name like *" & Trim(txtSearch.Text) & "*"
            
     If Not .EOF Then
       MsgBox !Name & " found in the database", vbInformation, "Record Found"
       txtSearch.SetFocus
     Else
        'search again from the beggining of the recordset
        .MoveFirst
        .Find "Name like *" & Trim(txtSearch.Text) & "*"
                
        If Not .EOF Then
           MsgBox !Name & " found in the database", vbInformation, "Record Found"
           txtSearch.SetFocus
        Else
           MsgBox "Record not found in the database", vbInformation, "Record Not Found"
           txtSearch.Text = vbNullString
        End If
     End If
Else
  MsgBox "There is no record to be searched", vbInformation, "No Record"
  txtSearch.Text = vbNullString
End If
End With

End Sub



....the double-clicking stuff is not included in the code, i think you can do it on your own

____________________________
Funny thought:

Practice makes perfect.....
But nobody's perfect......
so why practice?

07-11-2002 at 04:27 AM
View Profile Send Email to User Show All Posts | Quote Reply
Ayisha
Level: Trainee

Registered: 11-02-2007
Posts: 1
icon Re: Searching

ummm...hi

actually am a skool student

and i would like to know the search code for my database.

i tried the above code but it doesnt work

my database's name is "datvrs: and it goes like datvrs.recordset.EOF etc.

and my table's primary key is in digit format

so like if i type sum digit and i click search, i want tat particular number's records to be displayed

so plzz tell me the code with comments like ( ' this command is to display this record in this text box etc.)

THANKS ALOT IN ADVANCE!!!

11-02-2007 at 01:43 PM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : Database : Searching
Previous Topic (Opening Database for Exclusive Access)Next Topic (DataGrid Problem -- Urgent) 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