Private Sub Command2_Click()
Me.allxs.Caption = Nz(DSum("xs", "销售", _
"jzdate between #" & DTPicker1.Value & "# and #" & DTPicker2.Value & "#"))
End Sub
Private Sub dbcx_Click()
Dim Rs As New ADODB.Recordset
Dim Sql As String
Dim Conn As New ADODB.Connection
Set Conn = CurrentProject.Connection
Sql = "SELECT sum(销售.xs) AS 累计销售 FROM 销售 where jzdate between #" _
& DTPicker1.Value & "# and #" & DTPicker2.Value & "#"
Rs.Open Sql, Conn, adOpenForwardOnly, adLockReadOnly
If Not Rs.EOF Then
Me.allxs.Caption = Rs.Fields("累计销售").Value
End If