hi

i aam trying to develop a project using vb and access

i have got a problem

i have 3 tables in access

1.Cust info table(fields are listed below)
cust id,name,age,sex,country...etcxc(primary key cust id)

2,indate(fields are listed below)
custid ,packageid,date,intime,outime(no primary key)

3.package info table(fields are listed below
package id, package name,duration ,price(primary key packageid)


tthese three tables are connected...the attachment shows how it is connected

i want to write a query to select custid, custname,packageid,packagename,duration,price,date,timein,timeout from these tables in vb..n in a data grid to display these.i know to write simple queries but this one i think it needs inner join n stuff..can any expert resolve my problem..

Hi,

Try this :

Select CI.name,I.ServiceID,P.packagename,P.duration,P.price,I.date,I.timeIn,I.timeOut
From CustInfo CI, InDate I, PakInfo P Where CI.CustID = I.CustID And I.ServiceID = P.ServiceID Order By CI.Name

Recheck all your Table and Field Names..

Regards
Veena

This is sql statements works fine but id there any one who is having idea in how to use thisstatement in VB 2008

post your code, its more easy to understand

like in the following code what i am doing is if i push a button then it should choose next row from stud table and the scho should get the name from text1.text field and match in this table and should display the corrosponding row in scho table

Dim connect_string As String = _
          "Provider=Microsoft.Jet.OLEDB.4.0;" & _
          "Data Source=""" & TextBox4.Text & """;" & _
          "Persist Security Info=False"
        Dim conn_test As New OleDb.OleDbConnection(connect_string)
        conn_test.Open()

        Dim cmd4 As New OleDbCommand("SELECT * FROM Stud ORDER BY Name", conn_test)

        Dim studAdap As New OleDbDataAdapter
        studAdap = New OleDbDataAdapter
        studAdap.SelectCommand = cmd4

        Dim studTab As DataTable
        studTab = New DataTable()
        studAdap.Fill(studTab)

        '' MaskedTextBox1.DataBindings.Add("text", studTab, "name")
        TextBox1.DataBindings.Add("Text", studTab, "name")
        TextBox2.DataBindings.Add("Text", studTab, "lname")
        TextBox3.DataBindings.Add("Text", studTab, "score")
        lblPhotoFile.DataBindings.Add("Text", studTab, "foto")
        studMgr = DirectCast(Me.BindingContext(studTab), CurrencyManager)
        Call ShowPhoto()
  Dim cmd5 As New OleDbCommand("SELECT * FROM scho WHERE scho.name =  '" & TextBox1.Text & "'", conn_test)
      

        Dim schoAdapa As New OleDbDataAdapter '*****
        schoAdapa = New OleDbDataAdapter
        schoAdapa.SelectCommand = cmd5

        Dim schoTaba As DataTable  '******
        schoTaba = New DataTable()
        schoAdapa.Fill(schoTaba)

        TextBox5.DataBindings.Add("Text", schoTaba, "school")
        TextBox6.DataBindings.Add("Text", schoTaba, "city")
        Label4.DataBindings.Add("Text", studTab, "foto")

        Call ShowFhoto()
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.