I now have my project up and running and just need to fine tune a few things. My search from txtText3 is OK and produces the results I require but, there can be multiple choices for a paricular search. If the user searches for ABC there can be ABC1, ABC2, ABC3 etc and the form will only return the first field it finds. So I have attempted to add a combo box which will show a list of ABC1, ABC2, ABC3 etc and allow them to chose. How is it possible to populate the box and then select the result they want, which will in turn populate the other boxes?
Private Sub command1_click()
Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset
Set conn = New ADODB.Connection
Set rs = New ADODB.Recordset
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source = c:\db1.mdb"
conn.Open
Set rs = conn.Execute("SELECT TEST_NAME,TEST_CODE, AKA, ENTRY_CODE, SENT_TO, SAMPLE, MIN_VOL, HANDLE, TAT FROM TESTGUIDE WHERE TEST_NAME= '" & txtText3 & "' or TEST_CODE= '" & txtText3 & "' or AKA like '%" & txtText3 & "%'")
If Not rs Is Nothing Then
If Not rs.EOF Then
txtText1.Text = rs.Fields("TEST_NAME")
txtText2.Text = rs.Fields("TEST_CODE")
txtText4.Text = rs.Fields("AKA")
txtText5.Text = rs.Fields("ENTRY_CODE")
txtText6.Text = rs.Fields("SENT_TO")
txtText7.Text = rs.Fields("SAMPLE")
txtText8.Text = rs.Fields("MIN_VOL")
txtText9.Text = rs.Fields("HANDLE")
txtText10.Text = rs.Fields("TAT")
cmbCombo1.Text = rs.Fields("TEST_NAME")
End If
End If
Set rs = Nothing
Set conn = Nothing
End Sub
TIA
Private Sub command1_click()
Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset
Set conn = New ADODB.Connection
Set rs = New ADODB.Recordset
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source = c:\db1.mdb"
conn.Open
Set rs = conn.Execute("SELECT TEST_NAME,TEST_CODE, AKA, ENTRY_CODE, SENT_TO, SAMPLE, MIN_VOL, HANDLE, TAT FROM TESTGUIDE WHERE TEST_NAME= '" & txtText3 & "' or TEST_CODE= '" & txtText3 & "' or AKA like '%" & txtText3 & "%'")
If Not rs Is Nothing Then
If Not rs.EOF Then
txtText1.Text = rs.Fields("TEST_NAME")
txtText2.Text = rs.Fields("TEST_CODE")
txtText4.Text = rs.Fields("AKA")
txtText5.Text = rs.Fields("ENTRY_CODE")
txtText6.Text = rs.Fields("SENT_TO")
txtText7.Text = rs.Fields("SAMPLE")
txtText8.Text = rs.Fields("MIN_VOL")
txtText9.Text = rs.Fields("HANDLE")
txtText10.Text = rs.Fields("TAT")
cmbCombo1.Text = rs.Fields("TEST_NAME")
End If
End If
Set rs = Nothing
Set conn = Nothing
End Sub
TIA