Foxtable(狐表)用户栏目专家坐堂 → 自动默认为0的函数如何写?


  共有3292人关注过本帖树形打印复制链接

主题:自动默认为0的函数如何写?

帅哥哟,离线,有人找我吗?
owenlyx
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:童狐 帖子:213 积分:2237 威望:0 精华:0 注册:2012/9/3 16:21:00
自动默认为0的函数如何写?  发帖心情 Post By:2015/11/11 20:50:00 [显示全部帖子]

代码如下:
Dim dr As DataRow
Dim dd As DataRow 
Dim dc As DataRow  
dr = DataTables("进货明细").Find("条码号 = '"& e.Form.Controls("combobox1").text & "'and 基本款号 = '" & e.Form.Controls("combobox2").text & "'")
dd= DataTables("销售表").find("条码号 = '"& e.Form.Controls("combobox1").text & "'and 基本款号 = '" & e.Form.Controls("combobox2").text & "'")
dc= DataTables("退货表").Find("条码号 = '"& e.Form.Controls("combobox1").text & "'and 退货款号 = '" & e.Form.Controls("combobox2").text & "'")
‘If dr IsNot Nothing And dd IsNot Nothing And dc IsNot Nothing Then  
e.Form.Controls("label11").text = dr("件数") - dd("件数") -dc("件数")  

用什么函数可以设置 ’销售表‘里找不到此行自动默认为0 ,同理‘退货表’ 也是一样,请问代码如何写? 

 回到顶部
帅哥哟,离线,有人找我吗?
owenlyx
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:童狐 帖子:213 积分:2237 威望:0 精华:0 注册:2012/9/3 16:21:00
  发帖心情 Post By:2015/11/12 11:57:00 [显示全部帖子]

谢谢

 回到顶部
帅哥哟,离线,有人找我吗?
owenlyx
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:童狐 帖子:213 积分:2237 威望:0 精华:0 注册:2012/9/3 16:21:00
  发帖心情 Post By:2015/11/12 22:23:00 [显示全部帖子]

但是一直还是报错。 
我用的代码是这个:
Dim dr As DataRow
Dim dd As DataRow 
Dim dc As DataRow  
dr = DataTables("进货明细").Find("条码号 = '"& e.Form.Controls("combobox1").text & "'and 基本款号 = '" & e.Form.Controls("combobox2").text & "'")
dd= DataTables("销售表").find("条码号 = '"& e.Form.Controls("combobox1").text & "'and 基本款号 = '" & e.Form.Controls("combobox2").text & "'")
dc= DataTables("退货表").Find("条码号 = '"& e.Form.Controls("combobox1").text & "'and 退货款号 = '" & e.Form.Controls("combobox2").text & "'")
'If dr IsNot Nothing And dd IsNot Nothing And dc IsNot Nothing Then  
e.Form.Controls("label11").text = IIF(dr Is Nothing ,0,dr("件数")) - IIF(dd Is Nothing,0,dd("件数")) -IIF(dc Is Nothing,0,dc("件数"))

图片点击可在新窗口打开查看此主题相关图片如下:qq图片20151112221812.png
图片点击可在新窗口打开查看


[此贴子已经被作者于2015/11/12 22:23:07编辑过]

 回到顶部