ok Code:
Private Sub DisplayList(ByVal CusRef As Integer) Dim ConnectionString As String Dim SQLString As String Dim TitleString As String Dim conn As System.Data.OleDb.OleDbConnection Dim dr As System.Data.OleDb.OleDbDataReader Dim cmd As System.Data.OleDb.OleDbCommand ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;data " ConnectionString += "Source=" & "Opticians.accdb " conn = New System.Data.OleDb.OleDbConnection(ConnectionString) SQLString = "SELECT * FROM SpecSalesTable" 'SELECTS ALL INFORMATION Try ' FROM DATABASE conn.Open() If ConnectionState.Open Then cmd = New System.Data.OleDb.OleDbCommand(SQLString, conn) dr = cmd.ExecuteReader() If dr.HasRows Then FramesListBox.Items.Clear() While dr.Read If Not IsDBNull(dr.Item("CustomerID")) Then 'INSERTS INFORMATION INTO TitleString = dr.Item("CustomerID") ' LISTBOX FramesListBox.Items.Add(TitleString) End If End While End If dr.Close() End If Catch MessageBox.Show("Error accessing database") 'IF ERROR ENCOUNTERED SHOWS MESSAGE End Try conn.Close() End Sub
So that works, but how do I display multiple things, CustomerID & CustomerName on the same line?
I can't get it going, it only puts my CustomerName under the ID




Reply With Quote
