is this coorrct if write like this:

Public Class Lecturer_Form

Private Sub Lecturer_Form_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Dim conn As New System.Data.OleDb.OleDbConnection()
    conn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\temp\Database1.accdb"


    If conn.State = ConnectionState.Open Then conn.Close()
    conn.Open()
    Dim sql As String = "Select A.StaffNo,A.TimeIn,A.TimeOut, B.ProjectNo, C.AdminNo, C.UserName From tbl_lecturer A, tbl_assignment B, tbl_info C,= '" & TextBoxname.Text & "', '" & Textin.Text & "','" & Textout.Text & "'"
    Dim sqlCom As New System.Data.OleDb.OleDbCommand(sql, conn)
    sqlCom.Connection = conn
    Dim sqlReader As System.Data.OleDb.OleDbDataReader = sqlCom.ExecuteReader()

    If sqlReader.HasRows Then
        While (sqlReader.Read)
            ComboBoxstaff.Items.Add(sqlReader.Item("StaffNo").ToString)
            ComboBoxpro.Items.Add(sqlReader.Item("ProjectNo").ToString)
            ComboBoxadm.Items.Add(sqlReader.Item("AdminNo").ToString)
            TextBoxname.Text = (sqlReader.Item("UserName").ToString)
            Textin.Text = (sqlReader.Item("TimeIn").ToString)
            Textout.Text = (sqlReader.Item("TimeOut").ToString)
            LBtimeIN.Items.Add(sqlReader.Item("TimeIN").ToString)
            LBtimeIN.Items.Add(sqlReader.Item("TimeOut").ToString)
        End While
    End If
End Sub

End Class

Recommended Answers

All 6 Replies

Dim sql As String = "Select A.StaffNo,A.TimeIn,A.TimeOut, B.ProjectNo, C.AdminNo, C.UserName From tbl_lecturer A, tbl_assignment B, tbl_info C,= '" & TextBoxname.Text & "', '" & Textin.Text & "','" & Textout.Text & "'"

Do not understand the SQL Statement. What do you want?

after i choose the 3 combobox and in the tbl_info of the user name come out at textbox and tbl_lecturer time in and out in the textin, textout and the listboxin, listboxout time in and out..!

Your SQL Statement is wrong in the position of condition checking.
What are the relationships between these three tables?

these three table is when student register in it will come a form staff no project no and admin atfer chosse them in the below which of a stuednt have the project and which date have also what time they come in what time they go out

Describe the relation between these three tables in details or post the tablenames and their fieldnames.

this is the table name

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.