以下下代码 报错
此主题相关图片如下:01.jpg
如果 计划日期 = ' & rq & ' 处直接输入值不会报错 是什么问题
Dim tbl As WinForm.Table
Dim rq As Date= e.Form.Controls("DateTimePicker1").Value
If e.Form.ExistControl("Table1") Then
e.Form.RemoveControl("Table1")
tbl = e.Form.CreateSQLQuery("Table1", "Select [弹簧用量_物料编号] as 物料编号,[弹簧用量_物料名称] as 物料名称,[产品_型号] as 型号,[计量单位],[弹簧用量_单位用量] as 单位用量,数量,[弹簧用量_单位用量] * 数量 as 需求量,计划日期 From {用料清单} INNER JOIN {计划表} ON {用料清单}.[产品编号] = {计划表}.产品编号 WHERE 计划日期 = ' & rq & ' ORDER BY 计划日期","ERP")
tbl.SetBounds(20, 50, 700, 600)
e.Form.AddControl(tbl)
Else
tbl = e.Form.CreateSQLQuery("Table1", "Select [弹簧用量_物料编号] as 物料编号,[弹簧用量_物料名称] as 物料名称,[产品_型号] as 型号,[计量单位],[弹簧用量_单位用量] as 单位用量,数量,[弹簧用量_单位用量] * 数量 as 需求量,计划日期 From {用料清单} INNER JOIN {计划表} ON {用料清单}.[产品编号] = {计划表}.产品编号 WHERE 计划日期 = ' & rq & ' ORDER BY 计划日期","ERP")
tbl.SetBounds(20, 50, 700, 600)
e.Form.AddControl(tbl)
End If