有人请检查我的代码中是否有遗漏它昨天正常工作然后突然我没有得到这个查询的结果。当我试图查询当前日期时,它直接触发msgbox,但当我试图查询过去几天它正常工作,所以跛脚。这个代码所有工作昨天很好,现在我卡住dunno什么我失踪请帮助我们,我的截止日期到期。
Set RS = New ADODB.Recordset
RS.CursorLocation = adUseClient
RS.Open "SELECT StaffTable.ID, StaffTable.LastName, FirstTable.Description, " & _
"FirstIssue.DateIssue, FirstIssue.QtyIssue " & _
"FROM (StaffTable " & _
"INNER JOIN FirstIssue " & _
"ON FirstIssue.StaffID = StaffTable.ID) " & _
"INNER JOIN FirstTable " & _
"ON FirstTable.ItemNo = FirstIssue.ItemNo " & _
"WHERE FirstIssue.DateIssue BETWEEN #" & datepicker1 & "# " & _
"AND #" & datepicker2 & "#;", CN, adOpenForwardOnly, adLockReadOnly
If Not RS.EOF Then
With datareport1
.DataMember = vbNullString
Set .DataSource = RS
With .Sections("Section5").Controls
.Item("Function1").DataField = RS.Fields(4).Name
End With
With .Sections("Section1").Controls
.Item("Text1").DataField = RS.Fields(0).Name
.Item("Text2").DataField = RS.Fields(1).Name
.Item("Text3").DataField = RS.Fields(2).Name
.Item("Text4").DataField = RS.Fields(3).Name
.Item("Text5").DataField = RS.Fields(4).Name
End With
.Show vbModal
End With
Else
MsgBox "No current record to generate on this date(s).", vbInformation, "Information"
Exit Sub
End if