您的位置:程序门 -> vb -> vba



为什么传参数时出错


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


为什么传参数时出错[已结贴,结贴人:keyi_655]
发表于:2007-01-05 15:01:54 楼主
private   sub   loopmonthrow(fst_date_mm,   fst_date_dd,   last_date_mm,   last_date_dd   as   string,   row_no   as   integer)
looptofstmonthordate   fst_date_mm   &   str_month_nm,   int_row_month
looptofstmonthordate   fst_date_dd   ,   int_row_date

end   sub

private   sub   looptofstmonthordate(content   as   string,   row   as   integer)
。。。
end   sub

当我执行loopmonthrow这个方法时总是报错
looptofstmonthordate   fst_date_dd   ,   int_row_date
中的fst_date_dd参数“byref参数类型不匹配”,但是当我改成
looptofstmonthordate   fst_date_dd   &   " ",   int_row_date以后就对了。这是社呢们原因啊,应该怎么处理啊
发表于:2007-01-05 15:21:181楼 得分:5
looptofstmonthordate(content   as   string,   row   as   integer)中的参数类型是显式声明的,如果
将loopmonthrow(fst_date_mm,   fst_date_dd,   last_date_mm,   last_date_dd   as   string,   row_no   as   integer)
中的参数也都显式声明,且与调用looptofstmonthordate时传递的参数类型一值。fst_date_dd   &   " "相当如将fst_date_dd   强制转换成了字符串型,与   looptofstmonthordate中的参数类型一致,所以不会报错。
发表于:2007-01-10 11:56:312楼 得分:5
建议楼主定义变量时要显示指定类型,否则容易出错
发表于:2007-01-10 17:13:183楼 得分:0
那在定义变量时,如何显式或隐式指定变量的类型啊
发表于:2007-01-10 17:21:464楼 得分:0
“如果
将loopmonthrow(fst_date_mm,   fst_date_dd,   last_date_mm,   last_date_dd   as   string,   row_no   as   integer)
中的参数也都显式声明,”
难道我这里的参数不是显式声明吗?
发表于:2007-01-10 17:26:265楼 得分:5
fst_date_mm我就不知道是什么类型的变量
发表于:2007-01-10 18:39:096楼 得分:5
“如果
将loopmonthrow(fst_date_mm,   fst_date_dd,   last_date_mm,   last_date_dd   as   string,   row_no   as   integer)
中的参数也都显式声明,”
难道我这里的参数不是显式声明吗?

fst_data_mm,fst_date_dd,last_date_mm的数据类型是什么?


快速检索

最新资讯
热门点击