hello, i am a newbie in programming.
i am creating a simple database program right now with a single table using ms access.
i already finished some of its functions like add, save, delete, exit etc. my problem right now is i do not know how to search a particular record in my database and display its result to a table form in a datagrid. here is what i have so far...
What I would like to do is to a search a particular contact Id that is to be inputted in the txtContId.text and then show its other details in a table form using datagrid1.Code:Private Sub cmdSearch_Click() Dim cn As New ADODB.Connection Dim rs As New ADODB.Recordset cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\contact.mdb;Persist Security Info=False" Set rs = cn.Execute("SELECT * FROM Table1 WHERE contact Id = '" & txtContId.Text & "'") DataGrid1.DataSource = rs DataGrid1.Refresh End Sub
I hope somebody could help me with this....thank you in advance!
God bless!




Reply With Quote