Private Sub cmd查询_Click()
On Error GoTo Err_cmd查询_Click
Dim strWhere As String
strWhere = ""
If Not IsNull(Me.城区) Then
strWhere = strWhere & "([城区] like '*" & Me.城区 & "*') AND "
End If
If Not IsNull(Me.路段) Then
strWhere = strWhere & "([路段] like '" & Me.路段 & "') AND "
End If
If Not IsNull(Me.广告类型) Then
strWhere = strWhere & "([广告类型] like '*" & Me.广告类型 & "*') AND "
End If
If Not IsNull(Me.广告内容) Then
strWhere = strWhere & "([广告内容] like '" & Me.广告内容 & "') AND "
End If
If Not IsNull(Me.广告发布方) Then
strWhere = strWhere & "([广告发布方] like '" & Me.广告发布方 & "') AND "
End If
If Not IsNull(Me.面积开始) Then
strWhere = strWhere & "([面积] >= " & Me.面积开始 & ") AND "
End If
If Not IsNull(Me.面积截止) Then
strWhere = strWhere & "([面积] <= " & Me.面积截止 & ") AND "
End If
If Not IsNull(Me.发布时间开始) Then
strWhere = strWhere & "([发布时间] >= #" & Format(Me.发布时间开始, "yyyy-mm-dd") & "#) AND "
End If
If Not IsNull(Me.进书日期截止) Then
strWhere = strWhere & "([发布时间] <= #" & Format(Me.发布时间截止, "yyyy-mm-dd") & "#) AND "
End If
If Len(strWhere) > 0 Then
strWhere = Left(strWhere, Len(strWhere) - 5)
End If
If Me.存书查询子窗体.Form.Recordset.RecordCount > 0 Then
'子窗体的记录数>0
Me.计数.ControlSource = "=[全城区广告查询窗体].[Form].[txt计数]"
Me.面积.ControlSource = "=[全城区广告查询窗体].[Form].[txt面积合计]"
Else
'子窗体的记录数=0
Me.计数.ControlSource = "=0"
Me.合计.ControlSource = "=0"
End If
End Sub
Private Sub 城区_afterupdate()
Me.路段.RowSource = "select 路段,路段编号 from 城区路段表 where 城区='" & Me.城区 & "'"
End Sub
Private Sub 路段_AfterUpdate()
Me.全城区广告查询窗体.Form.Filter = "路段编号='" & Me.路段 & "'"
Me.全城区广告查询窗体.Form.FilterOn = True
End Sub作者: htlsb 时间: 2008-12-29 22:28
怎么没人理我啊,那位老师帮忙解决下啊作者: Henry D. Sy 时间: 2008-12-29 22:46
3楼链接里有个word文档你好好看看作者: fnsmydyang 时间: 2008-12-30 07:06
6D老师这么早就来看帖,辛苦了[:49]作者: htlsb 时间: 2008-12-30 17:03
哎,搞了好久了,可这查询的代码还是没办法运行,谁帮我看看问题在哪啊?作者: manken 时间: 2009-8-14 14:44
咋就没有人给解决呢?作者: weizexon 时间: 2009-9-11 04:06
来学习下~