Access交流中心

北京 | 上海 | 天津 | 重庆 | 广州 | 深圳 | 珠海 | 汕头 | 佛山 | 中山 | 东莞 | 南京 | 苏州 | 无锡 | 常州 | 南通 | 扬州 | 徐州 | 杭州 | 温州 | 宁波 | 台州 | 福州 | 厦门 | 泉州 | 龙岩 | 合肥 | 芜湖 | 成都 | 遂宁 | 长沙 | 株洲 | 湘潭 | 武汉 | 南昌 | 济南 | 青岛 | 烟台 | 潍坊 | 淄博 | 济宁 | 太原 | 郑州 | 石家庄 | 保定 | 唐山 | 西安 | 大连 | 沈阳 | 长春 | 昆明 | 兰州 | 哈尔滨 | 佳木斯 | 南宁 | 桂林 | 海口 | 贵阳 | 西宁 | 乌鲁木齐 | 包头 |

[5分]请问如何进行金额大小的查询

愉快  发表于:2009-10-29 17:26:48  
复制

我做了查询界面,里面有合同金额大小查询。很奇快,查询数据与合同金额第一个数据相同才可以查询。

 

Top
愉快 发表于:2009-10-29 17:27:51


愉快 发表于:2009-10-29 17:29:20

Private Function FiltFrmWhere() As String
 
        StrSql = ""
        If Not IsNull(Me.Text0) Then
            StrSql = StrSql & " danwei like '*" & Me.Text0 & "*' and "
        End If
        If Not IsNull(Me.Text4) Then
           StrSql = StrSql & " leixing like '*" & Me.Text4 & "*' and "
        End If
        If Not IsNull(Me.Text2) Then
           StrSql = StrSql & " mingzi like '*" & Me.Text2 & "*' and "
        End If
        If Not IsNull(Me.Text6) Then
           StrSql = StrSql & " shouji like '*" & Me.Text6 & "*' and "
        End If
       If Not IsNull(Me.Text12) Then
           StrSql = StrSql & " hetongyuanwen like '*" & Me.Text12 & "*' and "
        End If
        If Not IsNull(Me.Text14) Then
            StrSql = StrSql & " hetongjinge >= val('" & Me.Text14 & "') and "
        End If
        If Not IsNull(Me.Text8) Then
            StrSql = StrSql & " dengjiriqi >= #" & Me.Text8 & "# and "
        End If
        If Not IsNull(Me.Text10) Then
            StrSql = StrSql & " dengjiriqi <= #" & Me.Text10 & "# and "
        End If
       
        If Len(StrSql) > 0 Then
           StrSql = Left(StrSql, Len(StrSql) - 5)
        End If
       
     FiltFrmWhere = StrSql
End Function

 

点击下载此附件

andymark 发表于:2009-10-29 19:28:18

tblkehu 表 的hetongjinge 应该是数字或货币格式才合理

 

窗体frmchaxun 的Text14格式设置为同样的格式,这里是数字

 

FiltFrmWhere代码修改为

 

If Not IsNull(Me.Text14) Then
   StrSql = StrSql & " hetongjinge >= " & Me.Text14 & " and "
 End If

 

 

点击下载此附件

符鸿敏 发表于:2009-10-29 22:26:22

点击下载此附件

 

看看是不是这样?



愉快 发表于:2009-10-30 08:49:30
非常感谢,这么详细!

trynew 发表于:2009-10-30 08:51:05

tblkehu 表 的hetongjinge 应该是数字或货币格式才合理

 

窗体frmchaxun 的Text14格式设置为同样的格式,这里是数字

 

FiltFrmWhere代码修改为

 

        If Not IsNull(Me.Text14) Then
            StrSql = StrSql & " val(nz(hetongjinge)) >= " & Me.Text14 & " and "
        End If

楼主已经知道进行金额比较,要把文本转为数字,可惜转错对象了。你的表或查询中的hetongjinge字段本身是文本型(从表格中的对齐方式就可知道),要更保险,就两个都转换一下。



总记录:6篇  页次:1/1 9 1 :