Hi all
I am using Vb2008 Express and an Access DB.
I would like to Display a note from a column in the Notes_tbl to a text box this from an Access database.
Here is the code that I used but it does not do the job.

Dim mycon As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\DEsign.accdb"
        Dim Notes As String = "SELECT * FROM Notes_tbl "
        Dim conNotes As New OleDb.OleDbConnection(mycon)
        Dim Notescmd As New OleDb.OleDbCommand(Notes, conNotes)

        conNotes.Open()

        Dim ID As String = CStr(e.RowIndex)
        Dim qry As String = "SELECT Dsgntxt FROM Notes_tbl where dsgnid ="
        Notescmd.CommandType = CommandType.Text
        Notescmd.CommandText = qry & ID
        m_Notes = Notescmd.ExecuteReader()

        While m_Notes.Read
         txtNotes.Text = (m_Notes.GetString(1))
        End While

You should add your database to your projekt, then drag and drop your datatable to your form.
After this you should delete the generated datagridview, and drag and drop Dsgntxt to your textbox.
That's it.

thank you for your quick reply.
I am hoping I can use the connection rather than using the drag and drop. This is my first app. and would also be a way to learn how it is done.
If any one knows how to do it using this connection can you please reply .
thank you.

If you want to know, how it is working, then you should do manually:

1. making a bindingsource
2. making a dataset
3. making a tableadapter
4. making a bindingnavigator

Then setup all of this. When you will finish, your appliacation will work. Or simply drag and drop...

Dim mycon As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\DEsign.accdb"
Dim Notes As String = "SELECT * FROM Notes_tbl "
Dim conNotes As New OleDb.OleDbConnection(mycon)
Dim Notescmd As New OleDb.OleDbCommand(Notes, conNotes)

conNotes.Open()

Dim ID As String = CStr(e.RowIndex)
Dim qry As String = "SELECT Dsgntxt FROM Notes_tbl where dsgnid ="ID""
dim dr as new dataReader
dr = Notescmd.ExecuteReader()

While dr.Read()
txtNotes.Text = dr(0)
End While
use this code

does anyone knows how to bind source a text box in access form??

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.