kosala1981
Programmer
i want to display a value in a record set in a textbox .but it gave an error saying "You can't reference a property or method for a control unless the control has the focus"
here's my code : this is a Combo box click method.
Private Sub cmbIndicator_Click()--->Combo box
Dim rsRecordset As Recordset
Dim dbCurrent As Database
Dim sSql As String
sSql = "SELECT * FROM ComponentData WHERE ComponentData.nComponentId = ( SELECT nNumeratorCompId FROM Indicator WHERE tIndicatorName='" + Trim(cmbIndicator.Text) + "')"
Set dbCurrent = DBEngine.Workspaces(0).Databases(0)
Set rsRecordset = dbCurrent.OpenRecordset(sSql)
rsRecordset.MoveFirst
While Not rsRecordset.EOF
TextBox1.Text = rsRecordset.Fields("Criteria1").Value
rsRecordset.MoveNext
Wend
End Sub
here's my code : this is a Combo box click method.
Private Sub cmbIndicator_Click()--->Combo box
Dim rsRecordset As Recordset
Dim dbCurrent As Database
Dim sSql As String
sSql = "SELECT * FROM ComponentData WHERE ComponentData.nComponentId = ( SELECT nNumeratorCompId FROM Indicator WHERE tIndicatorName='" + Trim(cmbIndicator.Text) + "')"
Set dbCurrent = DBEngine.Workspaces(0).Databases(0)
Set rsRecordset = dbCurrent.OpenRecordset(sSql)
rsRecordset.MoveFirst
While Not rsRecordset.EOF
TextBox1.Text = rsRecordset.Fields("Criteria1").Value
rsRecordset.MoveNext
Wend
End Sub