im working on vb 2010 and ms access db..
just want to ask if a textbox with databinding can be used to search or filter data and display it to other textboxes with databinding on the same form? thank you..

Recommended Answers

All 7 Replies

Yes it can be done. Use your recordset to search for the criteria, once found, add each field value into its respective textbox.

Yes it can be done. Use your recordset to search for the criteria, once found, add each field value into its respective textbox.

sir if you wont mind can you give me an example how to do it..,

actually sir i have a datagrid on my form1 when double clicked form2 pop out then one of the textbox on my form 2 show the id num. now i wanted to use that textbox to search my db and input data on the other textbox on that form..

You will have something like this -

rsData.Open "SELECT * FROM YourTableNameHere WHERE YourFieldNameToSearchHere = '" & Text1.Text & "'", cnYourConnection, adOpenStatic, adLockOptimistic

Text2.Text = rsData!WhatEverResultYouGot
''etc....

there has been similar question here

there has been similar question here

well sir im sorry but my question was not similar to that one.. i know how to build connection bet.ms access and vbb2010.. what im asking is when the 2nd form pop out the textbox there must contains specific data from what id cell have been clicked. i know thats quite simple with you guys yet perhaps a good student have a great teacher.

Do you mean that when you click on the datagrid, it returns the id that you clicked on and then show that record in the second form?

What grid are you using?

Do you mean that when you click on the datagrid, it returns the id that you clicked on and then show that record in the second form?

What grid are you using?

yes sir exactly, datagrid sir in vb2010,
i have a datagrid on form1 connected with ms access.

i have this code for datagrid click

Public Sub dgv1_CellDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgv1.CellDoubleClick

        Dim empid As Object = dgv1.Rows(e.RowIndex).Cells(0).Value

        display.Text = Convert.ToString(empid)

        editempfrm.ShowDialog()


    End Sub

so on my display textbox which is also on my form2, the id number was being displayed, im thinking if i can put query on that textbox to display data corresponding to the id num on my next form sir..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.