I have table-accessonbook and second table as report register
I want to fetch data from one table as name,age,sex with unique id
from 2nd table i want fetch Hb with same id
so that when i enter peticular id it should fetch data from both tables linked to that id.
i tried much but nothing found. pl help.

in a button click event create 2 different connection(oleDb.oleDbConnection) like this

Dim Connection1 As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;" & "Data Source='" & "Access 1 Full Path" & "';" & "Persist Security Info=False;" & "Jet OLEDB:Database Password=" & "your pass" & ";")



Dim Connection2 As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;" & "Data Source='" & "Access 2 Full Path" & "';" & "Persist Security Info=False;" & "Jet OLEDB:Database Password=" & "your pass" & ";")

and of course different command for each table

        Dim cmd As OleDbCommand
        Dim dr As OleDbDataReader
        Try
            Connection1.Open()
            cmd = New OleDbCommand("SELECT *  from TableNameOfFirstAccess WHERE ID=" & ID.Text & "", Connection1)
            dr = cmd.ExecuteReader
            If dr.Read Then
                ID.Text = dr("ID")
                Age.Text = dr("Age")
                Sex.Text = dr("Sex")
                Name.Text = dr("Name")
            Else
                MsgBox("No Such Account")
            End If
        Catch
        End Try
        dr.Close()
        Connection1.Close()

        Try
            Connection2.Open()
            cmd = New OleDbCommand("SELECT *  from TableNameOfSecondAccess WHERE ID=" & ID.Text & "", Connection2)
            dr = cmd.ExecuteReader
            If dr.Read Then
                form2.Hb.Text = dr("Hb")
            Else
                MsgBox("No Such Account")
            End If
        Catch
        End Try
        dr.Close()
        Connection2.Close()

i have one more query.
I have a form with textbox as ID,Age, Sex ,HB, BG
and 2 tables in database . in table 1, there are ID,Age,Sex, HB
In table2 there are ID,Age,Sex and BG
When i save data with one button and enter value in ID,Age,Sex and HB , the data will be saved in Table1
And when I enter value in ID,Age,Sex and BG, the data should be saved in Table2.
Finally when i enter value in ID,Age,Sex,HB,BG, the data should be saved in both tables.
So how can i do that?

not able to solve my query.
pl help

read my answer in this

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.