|
我想做一个液氮罐的存储数据库,在窗体上同时显示一个盒子里的5*5或10*10的放冻存管的格子.
拜托各位帮我看看下面的代码,为什么Rst.Filter没有发生作用.
Private Sub Command60_Click()
Dim Rst As Recordset
Dim strWhere As String '定义条件字符串
strWhere = "" '设定初始值-空字符串
If Not IsNull(Me.Combo1) Then
'有输入
strWhere = strWhere & "([罐名称] like '*" & Me.Combo1 & "*') AND "
End If
If Not IsNull(Me.Combo2) Then
'有输入
strWhere = strWhere & "([架名称] like '*" & Me.Combo2 & "*') AND "
End If
If Not IsNull(Me.Combo3) Then
'有输入
strWhere = strWhere & "([层名称] like '*" & Me.Combo3 & "*') AND "
End If
Set Rst = CurrentDb().OpenRecordset("SELECT * From 冻存管")
Rst.Filter = strWhere
Do While Not Rst.EOF
On Error Resume Next
Controls("Label" & (Rst!孔ID)).Tag = "True"
If Controls("Label" & (Rst!孔ID)).Caption <> "层名称:" & Rst!层名称 & vbNewLine & "内容:" & Rst!内容 & _
vbNewLine & "名称:" & Rst!名称 Then
Controls("Label" & (Rst!孔ID)).Caption = ""
Controls("Label" & (Rst!孔ID)).Caption = "层名称:" & Rst!层名称 & vbNewLine & "内容:" & Rst!内容 & _
vbNewLine & "名称:" & Rst!名称
End If
Rst.MoveNext
Loop
End Sub
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|