vb adodc控件sql查询中日期变量引用错误
DimcK1AsString,cK2AsStringPrivateSubCheck1_Click()IfCheck1=1ThencK1="and销售日期between#"...
Dim cK1 As String, cK2 As String
Private Sub Check1_Click()
If Check1 = 1 Then
cK1 = " and 销售日期 between #" & DTPicker2 & "# and #" & DTPicker3 & "#"
Else: cK1 = ""
End If
End Sub
Private Sub Check2_Click()
If Check2 = 1 Then
cK2 = " and 票据编号='" & Text5.Text & "'"
Else: cK2 = ""
End If
End Sub
Private Sub Command1_Click()
SPDATA.RecordSource = "select * from dp_xsjl where id>0" & cK1 & "" & cK2 & ""
SPDATA.Refresh
End Sub
运行报错 : # 附近有语法错误 展开
Private Sub Check1_Click()
If Check1 = 1 Then
cK1 = " and 销售日期 between #" & DTPicker2 & "# and #" & DTPicker3 & "#"
Else: cK1 = ""
End If
End Sub
Private Sub Check2_Click()
If Check2 = 1 Then
cK2 = " and 票据编号='" & Text5.Text & "'"
Else: cK2 = ""
End If
End Sub
Private Sub Command1_Click()
SPDATA.RecordSource = "select * from dp_xsjl where id>0" & cK1 & "" & cK2 & ""
SPDATA.Refresh
End Sub
运行报错 : # 附近有语法错误 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询