You look at something like this
Dim strSql As String Dim groupId As String strSql = "Select ID from RevenueGroup where description = '" & ListO.Value & "'" Dim rec As Recordset set rec= CurrentProject.Connection.Execute strSql groupId = rec(0)
You need to set the query results to the recordset, and then derive the first value from its results. Without all the specific variable, I cannot compile it completely, but it should be a good template to start with.
source share