Hello.
I need to develop one application.
The code is as follows
Private Sub cboCity_Click(Area As Integer)
Dim strCatalog As String: strCatalog = "e:\data\stat\dao"
Dim strTable As String: strTable = "db_field.dbf"
Dim strTable_1 As String: strTable_1 = "value_f.dbf"
Dim sSQL1 As String
Dim strConnect As String
strConnect = "Provider=MSDASQL.1;" & "Persist Security Info=False;" & "Data Source=dBASE Files;" & "Initial Catalog=" & strCatalog
Set m_cn_1 = New ADODB.Connection
With m_cn_1
.ConnectionString = strConnect
.Open
End With
Dim strSQL1 As String
strSQL1 = "SELECT value_f.V_NAME "
strSQL1 = strSQL1 & "FROM value_f, db_field WHERE db_field.ID=value_f.VF_CODE and db_field.FIELD_N ='" & cboCity.BoundText & "'"
Set m_rs_1 = New ADODB.Recordset
With m_rs_1
.ActiveConnection = m_cn_1
.CursorLocation = adUseClient
.CursorType = adOpenForwardOnly
.LockType = adLockReadOnly
.Open strSQL1
End With
Set cboCity1.DataSource = m_rs_1
Set cboCity1.RowSource = m_rs_1
Set m_rs_1 = Nothing
End Sub
This application should get the boundtext from db_field.dbf and throw corresponding field of db_field.ID i.e. value_f.V_NAME into cboCity1
I guess that something is wrong with my sql statement.
Any help will be appreciated
Hayk