Good afternoon,
I know I have alot to learn so please bare with me :) Thank you in advanced for any help.
I have the following code which pulls values into a listview control. This works perfectly.
However I would also like to pull in values from another table in the database into certain combo boxes. I am not sure where to place this code within the current code.
Below is my current code
and below is the code i would like to integrate (just a sample of one combobox)
I know I have alot to learn so please bare with me :) Thank you in advanced for any help.
I have the following code which pulls values into a listview control. This works perfectly.
However I would also like to pull in values from another table in the database into certain combo boxes. I am not sure where to place this code within the current code.
Below is my current code
Code:
Private Sub Form_Load()
Dim myConn As ADODB.Connection
Set myConn = New ADODB.Connection
myConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=H:\Business Intelligence\VB6\Database9.mdb;"
myConn.Open
Dim strSQL As String 'our query string
Dim oRS As ADODB.Recordset 'our recordset object
Dim lvwItem As ListItem 'this is necessary to directly reference the ListView control
Set oRS = New ADODB.Recordset
'change this SQL as appropriate for your needs
strSQL = "SELECT Date_Entered, Loan_Number, Investor, State, Doc_type, Description, Number_Pages,Tracking_Number,Address, Processor, Reviewer1, executor1, Reviewer2, Executor2, Notes, Attorney, PLX, Clarifire_Completion, Attorney_Confirmation FROM MailTeamTracker "
'change oConn to reflect the Connection object you are using in your program
oRS.Open strSQL, myConn
'load the listview
Do While Not oRS.EOF
Set lvwItem = ListView1.ListItems.Add(, , Format(oRS.Fields.Item("Date_Entered").Value, "mm/dd/yyyy"))
lvwItem.SubItems(1) = oRS.Fields.Item("Loan_Number").Value & ""
lvwItem.SubItems(2) = oRS.Fields.Item("Investor").Value & ""
lvwItem.SubItems(3) = oRS.Fields.Item("State").Value & ""
lvwItem.SubItems(4) = oRS.Fields.Item("Doc_Type").Value & ""
lvwItem.SubItems(5) = oRS.Fields.Item("Description").Value & ""
lvwItem.SubItems(6) = oRS.Fields.Item("Number_Pages").Value & ""
lvwItem.SubItems(7) = oRS.Fields.Item("Tracking_Number").Value & ""
lvwItem.SubItems(8) = oRS.Fields.Item("Address").Value & ""
lvwItem.SubItems(9) = oRS.Fields.Item("Processor").Value & ""
lvwItem.SubItems(10) = oRS.Fields.Item("Reviewer1").Value & ""
lvwItem.SubItems(11) = oRS.Fields.Item("Executor1").Value & ""
lvwItem.SubItems(12) = oRS.Fields.Item("Reviewer2").Value & ""
lvwItem.SubItems(13) = oRS.Fields.Item("Executor2").Value & ""
lvwItem.SubItems(14) = oRS.Fields.Item("Notes").Value & ""
lvwItem.SubItems(15) = oRS.Fields.Item("Attorney").Value & ""
lvwItem.SubItems(16) = oRS.Fields.Item("PLX").Value & ""
lvwItem.SubItems(17) = oRS.Fields.Item("Clarifire_Completion").Value & ""
lvwItem.SubItems(18) = oRS.Fields.Item("Attorney_Confirmation").Value & ""
oRS.MoveNext
Loop
oRS.Close
Set oRS = Nothing
End Sub
Code:
Dim strSQL as String 'Declare the variables we need
Dim oRS as ADODB.Recordset
Set oRS = New ADODB.Recordset
strSQL = "SELECT Processor FROM Processor"
oRS.Open strSQL, myConn, adOpenForwardOnly, adLockReadOnly, adCmdText
With cboProcessor
.Clear
Do While Not oRS.EOF
.AddItem oRS.fields("Processor").value
oRS.MoveNext
Loop
End With
'Tidy up
oRS.Close
Set oRS = Nothing