主题:还是SQL复合查询的问题!
Private Sub Command1_Click()
If Check1.Value = 1 And Check2.Value = 0 Then
Adodc1.RecordSource = "select * from BIAO where LGD ='" & Text3.Text & "' and DGD ='" & Text6.Text & "'"
Adodc1.Refresh
End If
If Check1.Value = 0 And Check2.Value = 1 Then
Adodc1.RecordSource = "select * from BIAO where LGT>='" & CStr(Text2.Text) & "' and DGT<='" & CStr(Text4.Text) & "'"
Adodc1.Refresh
End If
If Check1.Value = 1 And Check2.Value = 1 Then
Adodc1.RecordSource = "select * from BIAO where LGD ='" & Text3.Text & "' and DGD ='" & Text6.Text & "' and LGT>='" & CStr(Text2.Text) & "' and DGT<='" & CStr(Text4.Text) & "'"
Adodc1.Refresh
End If
End Sub
运行提示"SELECT附近关键字语法错误"
还有REFRESH IADODC错误
If Check1.Value = 1 And Check2.Value = 0 Then
Adodc1.RecordSource = "select * from BIAO where LGD ='" & Text3.Text & "' and DGD ='" & Text6.Text & "'"
Adodc1.Refresh
End If
If Check1.Value = 0 And Check2.Value = 1 Then
Adodc1.RecordSource = "select * from BIAO where LGT>='" & CStr(Text2.Text) & "' and DGT<='" & CStr(Text4.Text) & "'"
Adodc1.Refresh
End If
If Check1.Value = 1 And Check2.Value = 1 Then
Adodc1.RecordSource = "select * from BIAO where LGD ='" & Text3.Text & "' and DGD ='" & Text6.Text & "' and LGT>='" & CStr(Text2.Text) & "' and DGT<='" & CStr(Text4.Text) & "'"
Adodc1.Refresh
End If
End Sub
运行提示"SELECT附近关键字语法错误"
还有REFRESH IADODC错误