J
Joe
Hi,
When the data in my combo cox changes, I need to execute a
query that returns a single scalar value. The method I am using is
shown below. It seems cumbersome. Is there some easier, less
cumbersome method of accomplishing the same thing?
Private Sub cboParticipant_Change()
Dim rs As ADODB.Recordset
Dim FacilityID As Integer
Dim FacilityName As String
Dim SQL As String
SQL = "SELECT FACILITY FROM PARTICIPANTS WHERE PARTICIPANTID = "
& CStr(cboParticipant.Value)
'MsgBox SQL
If DBConn.State = adStateClosed Then
DBConn.Open ConnStr
End If
'Assign to local variables.'
Set rs = DBConn.Execute(SQL)
With rs
If Not (rs.EOF And rs.BOF) Then
FacilityName = rs.Fields(0)
End If
End With
rs.Close
Set rs = Nothing
Me![Facility] = FacilityName
End Sub
Any Help Appreciated,
Joe
When the data in my combo cox changes, I need to execute a
query that returns a single scalar value. The method I am using is
shown below. It seems cumbersome. Is there some easier, less
cumbersome method of accomplishing the same thing?
Private Sub cboParticipant_Change()
Dim rs As ADODB.Recordset
Dim FacilityID As Integer
Dim FacilityName As String
Dim SQL As String
SQL = "SELECT FACILITY FROM PARTICIPANTS WHERE PARTICIPANTID = "
& CStr(cboParticipant.Value)
'MsgBox SQL
If DBConn.State = adStateClosed Then
DBConn.Open ConnStr
End If
'Assign to local variables.'
Set rs = DBConn.Execute(SQL)
With rs
If Not (rs.EOF And rs.BOF) Then
FacilityName = rs.Fields(0)
End If
End With
rs.Close
Set rs = Nothing
Me![Facility] = FacilityName
End Sub
Any Help Appreciated,
Joe