Im trying to get data from 2 tables to be part of this lookup.
When you choose an insurance from a dbcombo box I want it to run an SQL statement that looks at table1 and finds ALL of the matches in that table then takes the DrID field in the same table and matches it with the DrID field in a 2nd table.
But Im not sure how to do that...
Insurance Combo -> Matching insurances in table1 -> DrID field in table1 == DrID field in table 2 -> Display DrName, DrAddress (from table2) in MSHFlexgrid
I can display the data fine... im just not sure how create that type of SQL lookup.
USUALLY When I do something to fill a mshflexgrid I do it like this... So something that would work with the below code would be great! Thanks.
VB Code:
Dim sConnect As String Dim sSQL As String Dim dfwConn As ADODB.Connection Dim datPrimaryRs As New ADODB.Recordset 'set strings sConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source='" & frmlocation.Text1.Text & "';Persist Security Info=False" sSQL = "select InsRecID, SpecID, Insurance, InsuranceID from DrsInsuranceList where SpecID like '" & Text7.Text & "'" ' open connection Set dfwConn = New ADODB.Connection dfwConn.Open sConnect 'create a recordset using the provided collection datPrimaryRs.CursorLocation = adUseClient datPrimaryRs.Open sSQL, dfwConn, adOpenForwardOnly, adLockReadOnly Set MSHFlexGrid1.DataSource = datPrimaryRs




Reply With Quote