13-04-13, 02:25 PM
السلام عليكم
- هذا كود زر البحث بعد التعديل :
- تحياتي .
- هذا كود زر البحث بعد التعديل :
كود :
Private Sub cmdFind_Click()
Dim d1, d2 As Date
d1 = Format(Me.DTPicker1.Value, "yyyy/MM/dd")
d2 = Format(Me.DTPicker2.Value, "yyyy/MM/dd")
If rs.State = adStateOpen Then rs.Close
rs.Open "Select SUM(salary) as salary From tabel1 where da Between #" & d1 & "# and #" & d2 & "#", db, adOpenKeyset, adLockPessimistic
If rs.RecordCount > 0 Then
If Not IsNull(rs![salary]) Then Text3.Text = rs![salary] Else Text3.Text = "0"
Else
Text3.Text = "0"
End If
If rs.State = adStateOpen Then rs.Close
rs.Open "Select SUM(salary) as salary From back where da Between #" & d1 & "# and #" & d2 & "#", db, adOpenKeyset, adLockPessimistic
If rs.RecordCount > 0 Then
If Not IsNull(rs![salary]) Then Label10.Caption = rs![salary] Else Label10.Caption = "0"
Else
Label10.Caption = "0"
End If
If rs.State = 1 Then rs.Close
rs.Open "select * from sel where da Between #" & d1 & "# and #" & d2 & "#", db, adOpenStatic, adLockPessimistic
If rs.RecordCount <= 0 Then
MsgBox "لايوجد أصناف", vbInformation, "تنبيه"
Else
Do While Not rs.EOF
I = I + 1
grid.Rows = I + 1
grid.TextMatrix(I, 0) = rs("na")
grid.TextMatrix(I, 1) = rs("qe")
grid.TextMatrix(I, 2) = rs("pr")
grid.TextMatrix(I, 3) = rs("to")
rs.MoveNext ' يجب ان تضيفها
Loop
End If
End Sub- تحياتي .

