|
把里面的strWhere改成left(strWhere,len(strWhere)-1)再试试。- Private Sub Command4_Click()
- Dim strSQl As String
- Dim strWhere As String
- Dim ctl As Control
- Dim varI As Variant
- strSQl = "select * from 设备 where True "
- If Me.设备名称.ItemsSelected.Count > 0 Then
- Set ctl = Me.设备名称
- strWhere = ""
- For Each varI In ctl.ItemsSelected
- strWhere = strWhere & "'" & ctl.Column(0, varI) & "',"
- Next
- strSQl = strSQl & " And 设备名称 in (" & Left(strWhere, Len(strWhere) - 1) & ") "
- End If
- If Me.型号.ItemsSelected.Count > 0 Then
- Set ctl = Me.型号
- strWhere = ""
- For Each varI In ctl.ItemsSelected
- strWhere = strWhere & "'" & ctl.Column(0, varI) & "',"
- Next
- strSQl = strSQl & " And 型号 in (" & Left(strWhere, Len(strWhere) - 1) & ") "
- End If
- If Me.生产厂家.ItemsSelected.Count > 0 Then
- Set ctl = Me.生产厂家
- strWhere = ""
- For Each varI In ctl.ItemsSelected
- strWhere = strWhere & "'" & ctl.Column(0, varI) & "',"
- Next
- strSQl = strSQl & " And 生产厂家 in (" & Left(strWhere, Len(strWhere) - 1) & ") "
- End If
-
- Debug.Print strSQl
- Me.Child5.Form.RecordSource = strSQl
- End Sub
复制代码
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|