Function BuildSql()
Dim ctl As Control
Dim varItem As Variant
Dim strCrit As String, strSql As String
Set ctl = Forms!frmCustomerRecord.ListCustomer
strCrit = ""
strSql = "SELECT SomeField, SomeField2, etc. FROM etc. WHERE SomeField IN ("
For Each varItem In ctl.ItemsSelected
strCrit = strCrit & ctl.ItemData(varItm) & ","
Next varItm
strCrit = Left(strCrit,Len(strCrit)-1)
strSql = strSql & strCrit & ");"
'what goes here depends on what you want to do next.
'Make this the definition of a new or existing query?
'Run the sql? Set it to be the record source for a form or report?
'Execute the sql (if it is an Action query type)?
End Function