954,190 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How to Show Database In DataGrid Using DAO

Hi there,
I just registered and see that u have solve many problems for many ppl .. and I get good and new info and codes from u..

I'm having problem with Datagrid bcoz for really I'm not advanced devoloper,I'm using DAO to show me the records from database to the List,,which is not reconized for my project,,Now ,, I need to use Datagrid on my search form to show my search result.. so plz help me fast,, attachment is a Screenshot for my Search form..

this is the code and it is working on List,but i need code for datagrid:

Private Sub cmdFind_Click()
If txtFind.Text = "" Then
MsgBox "Enter text to search for", vbOKOnly, "Error"
Else
If cmbFind.Text = "User Name" Then
    Set rec = data.OpenRecordset("select * from PC where PC.UserName  Like '*" & txtFind.Text & "*'")
    With rec
    lstFind.Clear
    Do Until .EOF
   lstFind.AddItem ("User Name: " & .Fields(0) & " Owner: " & .Fields(1) & " User Type: " & .Fields(2))
    .MoveNext
     Loop
   
    End With
    
ElseIf cmbFind.Text = "PC Serial Number" Then
    Set rec = data.OpenRecordset("select * from PC where PC.PCSerialNumber  Like '*" & txtFind.Text & "*'")
    With rec
    lstFind.Clear
    Do Until .EOF
    lstFind.AddItem ("User Name: " & .Fields(0) & " Owner: " & .Fields(1) & " User Type: " & .Fields(2))
    .MoveNext
    Loop
    End With
End if
End Sub
Attachments search.JPG 23.7KB
Magna
Newbie Poster
1 post since Aug 2006
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You