Home > Software engineering >  Request a great god, and how can only display the current data, and the datagrid control display of
Request a great god, and how can only display the current data, and the datagrid control display of

Time:10-14

Private Sub Command1_Click ()
Mydate1=Left (the Format (DTPicker2. Value, "short date"), 4) + Right (Left (the Format (DTPicker2) Value, "short date"), 7), 2) + Right (the Format (DTPicker2. Value, "short date"), 2)
Mydate2=Left (the Format (DTPicker3. Value, "short date"), 4) + Right (Left (the Format (DTPicker3) Value, "short date"), 7), 2) + Right (the Format (DTPicker3. Value, "short date"), 2)
If Val (mydate1) & gt; Val (mydate1) Then
MsgBox "start time is not greater than end time", and "message"
DTPicker2. SetFocus
The Exit Sub
The Else
Adodc3. RecordSource="select * from yongjin where account opening time between '" + Str (DTPicker2. Value) +"' and '" + Str (DTPicker3. Value) + "' open an account in the order by the time "
Adodc3. RecordSource="select * from yongjin where account opening time & gt; '" + Str (DTPicker2. Value) + "' and account opening time & lt; '" + Str (DTPicker3. Value) + "' order by account opening time
"Adodc3. Refresh
The Set DataGrid1. The DataSource=Adodc3
End the If
Adodc3. RecordSource="select sum amount of (amount) as the from yongjin where the format (account opening time, '- dd yyyy - mm) & gt; '" + Str (DTPicker2. Value) + "' and the format (account opening time, '- dd yyyy - mm) & lt; '" + Str (DTPicker3. Value) + "' "
Adodc3. Refresh
On the Error Resume Next
If Adodc3. You. RecordCount & gt; 0 Then
Lbl_Total=Adodc3. You. Fields (0)
The Else
Lbl_Total. The Caption=0
End the If

End Sub
The above is the data for a period of time, and aggregate amount, but can only display the current, the great god

Private Sub Command3_Click ()
If Combo1. Text="" Then
MsgBox "please select a month to query,", "message"
Combo1. ListIndex=0
Combo1. SetFocus
The Exit Sub
The Else
Adodc3. RecordSource="select sum amount of (amount) as the from yongjin where the format (account opening time, 'yyyy - mm)=' 2013 - '+'" + Trim (Combo1. Text) + "'"
Adodc3. Refresh
On the Error Resume Next
If Adodc3. You. RecordCount & gt; 0 Then
Lbl_Total=Adodc3. You. Fields (0)
The Else
Lbl_Total. The Caption=0
End the If
Adodc3. RecordSource="select (amount) as the amount of the format (account opening time, 'yyyy - mm) as account opening time from yongjin" & amp; "Where the format (account opening time, 'yyyy - mm)=' 2013 - '+'" + Trim (Combo1. Text) + "' group by user name, service account, the format (account opening time, 'yyyy - mm)"
Adodc3. Refresh
If Adodc3. You. RecordCount & gt; 0 Then
Lbl_Count=Adodc3. You. RecordCount
The Else
Lbl_Count=0
End the If
The Set DataGrid1. The DataSource=Adodc3
End the If


End Sub
This is part of a month, also is the same, but display an error
  • Related