alipayande
New Member
سلام من یه مشکل با برنامم پیدا کردم
ارور ران تایم94 میده
برنامه با وی بی هستش
کسی می تونه کمکم کنه
!!!
ارور ران تایم94 میده
برنامه با وی بی هستش
کسی می تونه کمکم کنه

سلام من یه مشکل با برنامم پیدا کردم
ارور ران تایم94 میده
برنامه با وی بی هستش
کسی می تونه کمکم کنه!!!
Error 94 :
Invalid use of Null
Null is a Variant subtype used to indicate that a data item contains no valid data.
This error has the following cause and solution:
You are trying to obtain the value of a Variant variable or an expression that is Null.
For example:
MyVar = Null
For Count = 1 To MyVar
. . .
Next Count
Make sure the variable contains a valid value.
If IsNull(MyVar) = False Then
End If
Option Explicit
Dim strsearch As String
Dim tarikhjo As Date
Private Sub lockedfield[FONT="]()[/FONT]
[FONT="] [/FONT]text1.Locked = True
[FONT="] [/FONT]text2.Locked = True
[FONT="] [/FONT]Text3.Locked = True
[FONT="] [/FONT]Text4.Locked = True
[FONT="] [/FONT]Text5.Locked = True
[FONT="] [/FONT]Text6.Locked = True
[FONT="] [/FONT]Text7.Locked = True
End Sub
[FONT="] [/FONT]
Public Sub unlockedfield[FONT="]()[/FONT]
[FONT="] [/FONT]text1.Locked = False
[FONT="] [/FONT]text2.Locked = False
[FONT="] [/FONT]Text3.Locked = False
[FONT="] [/FONT]Text4.Locked = False
[FONT="] [/FONT]Text5.Locked = False
[FONT="] [/FONT]Text6.Locked = False
[FONT="] [/FONT]Text7.Locked = False
End Sub
[FONT="] [/FONT]
[FONT="] [/FONT]
[FONT="] [/FONT]
Private Sub cmdcancel_Click[FONT="]()[/FONT]
[FONT="] [/FONT]Adodc1.Recordset.CancelUpdate
[FONT="] [/FONT]Call hidebutton
[FONT="] [/FONT]Call lockedfield
End Sub
[FONT="] [/FONT]
Private Sub cmddelete_Click[FONT="]()[/FONT]
[FONT="] [/FONT]If Adodc1.Recordset.BOF And Adodc1.Recordset.EOF Then
[FONT="] [/FONT]Exit Sub
[FONT="] [/FONT]End If
[FONT="] [/FONT]Dim strp As Integer
[FONT="] [/FONT]strp = MsgBox[FONT="]("آيا مي خواهيد ركورد جاري را خذف كنيد؟", [/FONT]vbYesNo[FONT="], "حذف")[/FONT]
[FONT="] [/FONT]If strp = 6 Then
[FONT="] [/FONT]Adodc1.Recordset.Delete
[FONT="] [/FONT]End If
[FONT="] [/FONT]Adodc1.Recordset.MovePrevious
[FONT="] [/FONT]If Adodc1.Recordset.BOF Then
[FONT="] [/FONT]Adodc1.Recordset.MoveNext
[FONT="] [/FONT]End If
[FONT="] [/FONT]If Adodc1.Recordset.BOF And Adodc1.Recordset.EOF Then
[FONT="] [/FONT]Exit Sub
[FONT="] [/FONT]End If
[FONT="] [/FONT]text2.Text = Adodc1.Recordset(1).Value
End Sub
[FONT="] [/FONT]
Private Sub cmdfirst_Click[FONT="]()[/FONT]
[FONT="] [/FONT]If Adodc1.Recordset.BOF And Adodc1.Recordset.EOF Then
[FONT="] [/FONT]Exit Sub
[FONT="] [/FONT]End If
[FONT="] [/FONT]Adodc1.Recordset.MoveFirst
[FONT="] [/FONT]text2.Text = Adodc1.Recordset(1).Value
End Sub
[FONT="] [/FONT]
Private Sub cmdlast_Click[FONT="]()[/FONT]
[FONT="] [/FONT]If Adodc1.Recordset.BOF And Adodc1.Recordset.EOF Then
[FONT="] [/FONT]Exit Sub
[FONT="] [/FONT]End If
[FONT="] [/FONT]Adodc1.Recordset.MoveLast
[FONT="] [/FONT]text2.Text = Adodc1.Recordset(1).Value
End Sub
[FONT="] [/FONT]
Private Sub cmdmain_Click[FONT="]()[/FONT]
[FONT="] [/FONT]Form6.Hide
[FONT="] [/FONT]Unload Form6
[FONT="] [/FONT]Form2.Show
End Sub
[FONT="] [/FONT]
Private Sub cmdmodify_Click[FONT="]()[/FONT]
[FONT="] [/FONT]Call unhidebutton
[FONT="] [/FONT]Call unlockedfield
[FONT="] [/FONT]End Sub
[FONT="] [/FONT]
Private Sub cmdnew_Click[FONT="]()[/FONT]
[FONT="] [/FONT]Call unhidebutton
[FONT="] [/FONT]Call unlockedfield
[FONT="] [/FONT]text2.Text[FONT="] = ""[/FONT]
[FONT="] [/FONT]Adodc1.Recordset.AddNew
End Sub
[FONT="] [/FONT]
Private Sub cmdnext_Click[FONT="]()[/FONT]
[FONT="] [/FONT]If Adodc1.Recordset.BOF And Adodc1.Recordset.EOF Then
[FONT="] [/FONT]Exit Sub
[FONT="] [/FONT]End If
[FONT="] [/FONT]Adodc1.Recordset.MoveNext
[FONT="] [/FONT]If Adodc1.Recordset.EOF Then
[FONT="] [/FONT]Adodc1.Recordset.MoveLast
[FONT="] [/FONT]End If
[FONT="] [/FONT]text2.Text = Adodc1.Recordset(1).Value
End Sub
[FONT="] [/FONT]
Private Sub cmdok_Click[FONT="]()[/FONT]
[FONT="] [/FONT]Dim X As Integer
[FONT="] [/FONT]tarikhjo = CDate(text2.Text[FONT="])[/FONT]
[FONT="] [/FONT]Adodc1.Recordset(1).Value = CStr(tarikhjo[FONT="])[/FONT]
[FONT="] [/FONT]On Error Resume Next
[FONT="] [/FONT]Adodc1.Recordset.Update
[FONT="] [/FONT]If Err <> 0 Then
[FONT="] [/FONT]X = MsgBox[FONT="]("شماره پرونده وجود ندارد", , "خطا")[/FONT]
[FONT="] [/FONT]Exit Sub
[FONT="] [/FONT]End If
[FONT="] [/FONT]Call hidebutton
[FONT="] [/FONT]Call lockedfield
End Sub
[FONT="] [/FONT]
Private Sub cmdperivious_Click[FONT="]()[/FONT]
[FONT="] [/FONT]If Adodc1.Recordset.BOF And Adodc1.Recordset.EOF Then
[FONT="] [/FONT]Exit Sub
[FONT="] [/FONT]End If
[FONT="] [/FONT]Adodc1.Recordset.MovePrevious
[FONT="] [/FONT]If Adodc1.Recordset.BOF Then
[FONT="] [/FONT]Adodc1.Recordset.MoveFirst
[FONT="] [/FONT]End If
[FONT="] [/FONT]text2.Text = Adodc1.Recordset(1).Value
End Sub
[FONT="] [/FONT]
Private Sub cmdsearch_Click[FONT="]()[/FONT]
[FONT="] [/FONT]Dim book1 As Variant
[FONT="] [/FONT]book1 = Adodc1.Recordset.Bookmark
[FONT="] [/FONT]Adodc1.Recordset.MoveFirst
[FONT="] [/FONT]If optshomare.Value Then
[FONT="] [/FONT]strsearch = InputBox[FONT="]("لطفا شماره پرونده شخص مور نظر را وارد كنيد")[/FONT]
[FONT="] [/FONT]If strsearch = "" Then
[FONT="] [/FONT]Adodc1.Recordset.Bookmark = book1
[FONT="] [/FONT]Exit Sub
[FONT="] [/FONT]End If
[FONT="] [/FONT]Adodc1.Recordset.Find "shomare_parvande=" & strsearch
[FONT="] [/FONT]Command2.Enabled = True
[FONT="] [/FONT]If Adodc1.Recordset.EOF Then
[FONT="] [/FONT]Adodc1.Recordset.Bookmark = book1
[FONT="] [/FONT]MsgBox[FONT="] ("شخص مورد نظر وجود ندارد")[/FONT]
[FONT="] [/FONT]Exit Sub
[FONT="] [/FONT]End If
[FONT="] [/FONT]text2.Text = Adodc1.Recordset(1).Value
[FONT="] [/FONT]End If
End Sub
[FONT="] [/FONT]
Private Sub Command1_Click[FONT="]()[/FONT]
[FONT="] [/FONT]Dim bk
[FONT="] [/FONT]bk = Adodc1.Recordset.Bookmark
[FONT="] [/FONT]Adodc1.CommandType = adCmdText
[FONT="] [/FONT]Adodc1.RecordSource = "select count(shomare_parvande) from moraje where shomare_parvande='" & text1.Text[FONT="] & "'"[/FONT]
[FONT="] [/FONT]Adodc1.Refresh
[FONT="] [/FONT]Label3.Caption = Adodc1.Recordset.Fields(0).Value
[FONT="] [/FONT]Adodc1.CommandType = adCmdText
[FONT="] [/FONT]Adodc1.RecordSource = "select * from moraje[FONT="]"[/FONT]
[FONT="] [/FONT]Adodc1.Refresh
[FONT="] [/FONT]Adodc1.Recordset.Bookmark = bk
End Sub
[FONT="] [/FONT]
Private Sub Command2_Click[FONT="]()[/FONT]
[FONT="] [/FONT]Dim X As String
[FONT="] [/FONT]cmdsearch.Enabled = False
[FONT="] [/FONT]If Not Adodc1.Recordset.EOF Then
[FONT="] [/FONT]Adodc1.Recordset.MoveNext
[FONT="] [/FONT]End If
[FONT="] [/FONT]If Adodc1.Recordset.EOF Then
[FONT="] [/FONT]X = MsgBox[FONT="]("شخص مورد نظر پيدا نشد", , "جستجو")[/FONT]
[FONT="] [/FONT]cmdsearch.Enabled = True
[FONT="] [/FONT]Command2.Enabled = False
[FONT="] [/FONT]Adodc1.Recordset.MoveFirst
[FONT="] [/FONT]Exit Sub
[FONT="] [/FONT]End If
[FONT="] [/FONT]Adodc1.Recordset.Find "shomare_parvande=" & strsearch
[FONT="] [/FONT]If Not Adodc1.Recordset.EOF Then
[FONT="] [/FONT]text2.Text = Adodc1.Recordset(1).Value
[FONT="] [/FONT]End If
End Sub
[FONT="] [/FONT]
Private Sub Form_Load[FONT="]()[/FONT]
[FONT="] [/FONT]strsearch = no
[FONT="] [/FONT]Call lockedfield
[FONT="] [/FONT]Call hidebutton
[FONT="] [/FONT]Calendar = vbCalHijri
[FONT="] [/FONT]If Adodc1.Recordset.BOF And Adodc1.Recordset.EOF Then
[FONT="] [/FONT]Exit Sub
[FONT="] [/FONT]End If
[FONT="] [/FONT]Adodc1.Recordset.Sort = "tarikh[FONT="]"[/FONT]
[FONT="] [/FONT]Adodc1.Recordset.Find "shomare_parvande=" & no
[FONT="] [/FONT]If Adodc1.Recordset.EOF Then
[FONT="] [/FONT]Adodc1.Recordset.MoveFirst
[FONT="] [/FONT]End If
[FONT="] [/FONT]text2.Text = Adodc1.Recordset(1).Value
End Sub
[FONT="] [/FONT]
Public Sub hidebutton[FONT="]()[/FONT]
[FONT="] [/FONT]cmddelete.Visible = True
[FONT="] [/FONT]cmdmodify.Visible = True
[FONT="] [/FONT]cmdnew.Visible = True
[FONT="] [/FONT]cmdsearch.Visible = True
[FONT="] [/FONT]cmdlast.Visible = True
[FONT="] [/FONT]cmdperivious.Visible = True
[FONT="] [/FONT]cmdnext.Visible = True
[FONT="] [/FONT]cmdfirst.Visible = True
[FONT="] [/FONT]cmdcancel.Visible = False
[FONT="] [/FONT]cmdok.Visible = False
[FONT="] [/FONT]cmdmain.Visible = True
End Sub
[FONT="] [/FONT]
Public Sub unhidebutton[FONT="]()[/FONT]
[FONT="] [/FONT]cmddelete.Visible = False
[FONT="] [/FONT]cmdmodify.Visible = False
[FONT="] [/FONT]cmdnew.Visible = False
[FONT="] [/FONT]cmdsearch.Visible = False
[FONT="] [/FONT]cmdlast.Visible = False
[FONT="] [/FONT]cmdperivious.Visible = False
[FONT="] [/FONT]cmdnext.Visible = False
[FONT="] [/FONT]cmdfirst.Visible = False
[FONT="] [/FONT]cmdcancel.Visible = True
[FONT="] [/FONT]cmdok.Visible = True
[FONT="] [/FONT]cmdmain.Visible = False
End Sub
[FONT="] [/FONT]
[FONT="] [/FONT]
Private Sub Text2_LostFocus[FONT="]()[/FONT]
[FONT="] [/FONT]Dim X As Integer
[FONT="] [/FONT]If Not IsDate(text2.Text) Then
[FONT="] [/FONT]text2.Text[FONT="] = ""[/FONT]
[FONT="] [/FONT]X = MsgBox[FONT="]("لطفا يك تاريخ معتبر وارد كنيد.", , "خطا")[/FONT]
[FONT="] [/FONT]text2.SetFocus
[FONT="] [/FONT]End If
End Sub
text2.Text = Adodc1.Recordset(1).Value
If IsNull(Adodc1.Recordset(1).Value) = False Then
text2.Text = Adodc1.Recordset(1).Value
Else
text2.Text = ""
End If
آقا خیلی دمت گرم
مشکلم حل شد
فقط یه چیزی این کد چون خودتون گفتید از سر واکنی هستش بعد ها مشکل ساز نمی شه
Adodc3.Recordset.Fields(7).Value = CStr(Adodc1.Recordset.Fields(4).Value)
Option Explicit
Dim strreport As String, q As String
Dim intamar(1 To 47) As Integer
Dim strdate As String
Dim i As Byte
Dim k As Integer
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub cmdmain_Click()
form3.Hide
Unload form3
Form2.Show
End Sub
Private Sub Command1_Click()
Dim s As String, s1 As String
Dim d As Date, d1 As Date
s = Text1 & "/" & Text2 & "/" & Text3
s1 = Text4 & "/" & Text5 & "/" & Text6
If Not IsDate(s) Or Not IsDate(s1) Then Exit Sub
d = CDate(s)
d1 = CDate(s1)
s = CStr(d)
s1 = CStr(d1)
'report for gender
For i = 1 To 44
intamar(i) = 0
Next
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select count(gender), gender from reportfine WHERE tarikh>='" & s & "'" & "AND tarikh<='" & s1 & "' group by gender"
Adodc1.Refresh
If Adodc1.Recordset.BOF And Adodc1.Recordset.EOF Then
Exit Sub
End If
Adodc1.Recordset.MoveFirst
While Not Adodc1.Recordset.EOF
If IsNull(Adodc1.Recordset.Fields(1).Value) Then
DoEvents
Else
Select Case Adodc1.Recordset.Fields(1).Value
Case "ãÐßÑ"
intamar(2) = Adodc1.Recordset.Fields(0).Value
Case "ãæäË"
intamar(1) = Adodc1.Recordset.Fields(0).Value
End Select
End If
Adodc1.Recordset.MoveNext
Wend
intamar(3) = intamar(1) + intamar(2)
'report for tahsilat
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select count(modrak_tahsili),modrak_tahsili from reportfine WHERE tarikh>='" & s & "'" & "AND tarikh<='" & s1 & "'group by modrak_tahsili"
Adodc1.Refresh
If Adodc1.Recordset.BOF And Adodc1.Recordset.EOF Then
Exit Sub
End If
Adodc1.Recordset.MoveFirst
While Not Adodc1.Recordset.EOF
If IsNull(Adodc1.Recordset.Fields(1).Value) Then
DoEvents
Else
Select Case Adodc1.Recordset.Fields(1).Value
Case "ÈíÓæÇÏ"
intamar(4) = Adodc1.Recordset.Fields(0).Value
Case "ÎæÇäÏä æ äæÔÊä"
intamar(5) = Adodc1.Recordset.Fields(0).Value
Case "ÑÇåäãÇíí æÓíßá"
intamar(6) = Adodc1.Recordset.Fields(0).Value
Case "Ïíáã", "íÔ ÏÇäÔÇåí íÇ Ïíáã"
intamar(7) = intamar(7) + Adodc1.Recordset.Fields(0).Value
Case "ÏßÊÑÇ", "ÝæÞ áíÓÇäÓ", "áíÓÇäÓ", "ÝæÞ Ïíáã"
intamar(8) = intamar(8) + Adodc1.Recordset.Fields(0).Value
End Select
End If
Adodc1.Recordset.MoveNext
Wend
intamar(9) = intamar(4) + intamar(5) + intamar(6) + intamar(7) + intamar(8)
'report for vaseat tahol
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select count(v_taahole),v_taahole from reportfine WHERE tarikh>='" & s & "'" & "AND tarikh<='" & s1 & "'group by v_taahole"
Adodc1.Refresh
If Adodc1.Recordset.BOF And Adodc1.Recordset.EOF Then
Exit Sub
End If
Adodc1.Recordset.MoveFirst
While Not Adodc1.Recordset.EOF
If IsNull(Adodc1.Recordset.Fields(1).Value) Then
DoEvents
Else
Select Case Adodc1.Recordset.Fields(1).Value
Case "ãÌÑÏ"
intamar(10) = Adodc1.Recordset.Fields(0).Value
Case "ÇÒÏæÇÌ ãÌÏÏ", "ãÊÇåá"
intamar(11) = Adodc1.Recordset.Fields(0).Value
Case "ãØáÞå íÇ ãÊÇÑßå"
intamar(12) = Adodc1.Recordset.Fields(0).Value
Case "åãÓÑ ÝæÊ ßÑÏå"
intamar(13) = Adodc1.Recordset.Fields(0).Value
End Select
End If
Adodc1.Recordset.MoveNext
Wend
intamar(14) = intamar(10) + intamar(11) + intamar(12) + intamar(13)
'report for shoghle
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select count(shoghle),shoghle from reportfine WHERE tarikh>='" & s & "'" & "AND tarikh<='" & s1 & "'group by shoghle"
Adodc1.Refresh
If Adodc1.Recordset.BOF And Adodc1.Recordset.EOF Then
Exit Sub
End If
Adodc1.Recordset.MoveFirst
While Not Adodc1.Recordset.EOF
If IsNull(Adodc1.Recordset.Fields(1).Value) Then
DoEvents
Else
Select Case Adodc1.Recordset.Fields(1).Value
Case "ÏÇäÔ ÂãæÒ"
intamar(15) = Adodc1.Recordset.Fields(0).Value
Case "ÏÇäÔÌæ"
intamar(16) = Adodc1.Recordset.Fields(0).Value
Case "ÎÇäå ÏÇÑ"
intamar(17) = Adodc1.Recordset.Fields(0).Value
Case "ßæÏß", "ÈíßÇÑ"
intamar(18) = intamar(18) + Adodc1.Recordset.Fields(0).Value
Case "ÈÇÒäÔÓÊå"
intamar(19) = Adodc1.Recordset.Fields(0).Value
Case "ÔÇÛá ÏÑ ÈÎÔ ÏæáÊí"
intamar(20) = Adodc1.Recordset.Fields(0).Value
Case "ÔÇÛá ÏÑ ÈÎÔ ÎÕæÕí"
intamar(21) = Adodc1.Recordset.Fields(0).Value
End Select
End If
Adodc1.Recordset.MoveNext
Wend
intamar(22) = intamar(15) + intamar(16) + intamar(17) + intamar(18) + intamar(19) + intamar(20) + intamar(21)
'report for noe khadamat
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select count(khadamat),khadamat from reportfine WHERE tarikh>='" & s & "'" & "AND tarikh<='" & s1 & "'group by khadamat"
Adodc1.Refresh
If Adodc1.Recordset.BOF And Adodc1.Recordset.EOF Then
Exit Sub
End If
Adodc1.Recordset.MoveFirst
While Not Adodc1.Recordset.EOF
If IsNull(Adodc1.Recordset.Fields(1).Value) Then
DoEvents
Else
Select Case Adodc1.Recordset.Fields(1).Value
Case "ÝÑÏí"
intamar(23) = Adodc1.Recordset.Fields(0).Value
Case "Ñæåí"
intamar(24) = Adodc1.Recordset.Fields(0).Value
Case "ÎÇäæÇÏå"
intamar(25) = Adodc1.Recordset.Fields(0).Value
Case "ÒæÌ"
intamar(26) = Adodc1.Recordset.Fields(0).Value
Case "ãÏÏßÇÑí"
intamar(27) = Adodc1.Recordset.Fields(0).Value
Case "ßáÇÓ ÂãæÒÔí"
intamar(28) = Adodc1.Recordset.Fields(0).Value
Case "ÓÇíÑÎÏãÇÊ"
intamar(29) = Adodc1.Recordset.Fields(0).Value
End Select
End If
Adodc1.Recordset.MoveNext
Wend
intamar(30) = intamar(23) + intamar(24) + intamar(25) + intamar(26) + intamar(27) + intamar(28) + intamar(29)
'report for moshakhasat
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select count(elat_maraje),elat_maraje from reportfine WHERE tarikh>='" & s & "'" & "AND tarikh<='" & s1 & "'group by elat_maraje"
Adodc1.Refresh
If Adodc1.Recordset.BOF And Adodc1.Recordset.EOF Then
Exit Sub
End If
Adodc1.Recordset.MoveFirst
While Not Adodc1.Recordset.EOF
If IsNull(Adodc1.Recordset.Fields(1).Value) Then
DoEvents
Else
Select Case Adodc1.Recordset.Fields(1).Value
Case "ÇÎÊáÇáÇÊ ÑæÇäí", "ÇÝÓÑÏí", "ÇÖØÑÇÈ", "æÓæÇÓ"
intamar(31) = intamar(31) + Adodc1.Recordset.Fields(0).Value
Case "ãÔßáÇÊ ÎÇäæÇÏí"
intamar(32) = Adodc1.Recordset.Fields(0).Value
Case "ãÔßáÇÊ ÒäÇÔæíí"
intamar(33) = Adodc1.Recordset.Fields(0).Value
Case "ãÔßáÇÊ ÇÞÊÕÇÏí æ ÔÛáí"
intamar(34) = Adodc1.Recordset.Fields(0).Value
Case "ãÔßáÇÊ ÇÌÊãÇÚí æ ÈÒåßÇÑí"
intamar(35) = Adodc1.Recordset.Fields(0).Value
Case "ãÔßáÇÊ ÌäÓí"
intamar(36) = Adodc1.Recordset.Fields(0).Value
Case "ãÔßáÇÊ ãÑÊÈØ ÈÇ ÑæíÏÇÏåÇí ÇÓÊÑÓ ÒÇí ÒäÏí"
intamar(37) = Adodc1.Recordset.Fields(0).Value
Case "ÇÑÇÆå ÑÇåäãÇíí"
intamar(38) = Adodc1.Recordset.Fields(0).Value
Case "ãÔßáÇÊ ÊÍÕíáí"
intamar(39) = Adodc1.Recordset.Fields(0).Value
Case "ÇÚÊíÇÏ"
intamar(40) = Adodc1.Recordset.Fields(0).Value
Case "ÓÇíÑ ãæÇÑÏ"
intamar(41) = Adodc1.Recordset.Fields(0).Value
Case "ãÔßáÇÊ ßæÏßÇä"
intamar(42) = Adodc1.Recordset.Fields(0).Value
Case "ãÔÇæÑå ÇÒÏæÇÌ"
intamar(43) = Adodc1.Recordset.Fields(0).Value
End Select
End If
Adodc1.Recordset.MoveNext
Wend
intamar(44) = intamar(31) + intamar(32) + intamar(33) + intamar(34) + intamar(35) + intamar(36) + intamar(37) + intamar(38) + intamar(39) + intamar(40) + intamar(41) + intamar(42) + intamar(43)
'report noeshoghl
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select count(noe_shoghle), noe_shoghle from reportfine WHERE tarikh>='" & s & "'" & "AND tarikh<='" & s1 & "' group by noe_shoghle"
Adodc1.Refresh
If Adodc1.Recordset.BOF And Adodc1.Recordset.EOF Then
Exit Sub
End If
Adodc1.Recordset.MoveFirst
While Not Adodc1.Recordset.EOF
If IsNull(Adodc1.Recordset.Fields(1).Value) Then
DoEvents
Else
Select Case Adodc1.Recordset.Fields(1).Value
Case "æ"
intamar(45) = Adodc1.Recordset.Fields(0).Value
Case "Û"
intamar(46) = Adodc1.Recordset.Fields(0).Value
End Select
End If
Adodc1.Recordset.MoveNext
Wend
intamar(47) = intamar(45) + intamar(46)
Call insertrecord1
Adodc2.Refresh
cr5.ReportFileName = "C:\RAVANPOYA\report\rcenter.rpt"
cr5.RetrieveDataFiles
cr5.SelectionFormula = "{report.f1}>=0"
cr5.Action = 1
Command1.Enabled = False
Timer1.Enabled = True
End Sub
Private Sub Command2_Click()
Dim s As String, s1 As String
Dim d As Date, d1 As Date
s = Text1 & "/" & Text2 & "/" & Text3
s1 = Text4 & "/" & Text5 & "/" & Text6
If Not IsDate(s) Or Not IsDate(s1) Then Exit Sub
d = CDate(s)
d1 = CDate(s1)
s = CStr(d)
s1 = CStr(d1)
'report for gender
For i = 1 To 44
intamar(i) = 0
Next
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select count(gender), gender from moshtarydarmanjo WHERE tarikh_primary>='" & s & "'" & "AND tarikh_primary<='" & s1 & "' group by gender"
Adodc1.Refresh
If Adodc1.Recordset.BOF And Adodc1.Recordset.EOF Then
Exit Sub
End If
Adodc1.Recordset.MoveFirst
While Not Adodc1.Recordset.EOF
If IsNull(Adodc1.Recordset.Fields(1).Value) Then
DoEvents
Else
Select Case Adodc1.Recordset.Fields(1).Value
Case "ãÐßÑ"
intamar(2) = Adodc1.Recordset.Fields(0).Value
Case "ãæäË"
intamar(1) = Adodc1.Recordset.Fields(0).Value
End Select
End If
Adodc1.Recordset.MoveNext
Wend
intamar(3) = intamar(1) + intamar(2)
'report for tahsilat
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select count(modrak_tahsili),modrak_tahsili from moshtarydarmanjo WHERE tarikh_primary>='" & s & "'" & "AND tarikh_primary<='" & s1 & "'group by modrak_tahsili"
Adodc1.Refresh
If Adodc1.Recordset.BOF And Adodc1.Recordset.EOF Then
Exit Sub
End If
Adodc1.Recordset.MoveFirst
While Not Adodc1.Recordset.EOF
If IsNull(Adodc1.Recordset.Fields(1).Value) Then
DoEvents
Else
Select Case Adodc1.Recordset.Fields(1).Value
Case "ÈíÓæÇÏ"
intamar(4) = Adodc1.Recordset.Fields(0).Value
Case "ÎæÇäÏä æ äæÔÊä"
intamar(5) = Adodc1.Recordset.Fields(0).Value
Case "ÑÇåäãÇíí æÓíßá"
intamar(6) = Adodc1.Recordset.Fields(0).Value
Case "Ïíáã", "íÔ ÏÇäÔÇåí íÇ Ïíáã"
intamar(7) = intamar(7) + Adodc1.Recordset.Fields(0).Value
Case "ÏßÊÑÇ", "ÝæÞ áíÓÇäÓ", "áíÓÇäÓ", "ÝæÞ Ïíáã"
intamar(8) = intamar(8) + Adodc1.Recordset.Fields(0).Value
End Select
End If
Adodc1.Recordset.MoveNext
Wend
intamar(9) = intamar(4) + intamar(5) + intamar(6) + intamar(7) + intamar(8)
'report for vaseat tahol
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select count(v_taahole),v_taahole from moshtarydarmanjo WHERE tarikh_primary>='" & s & "'" & "AND tarikh_primary<='" & s1 & "'group by v_taahole"
Adodc1.Refresh
If Adodc1.Recordset.BOF And Adodc1.Recordset.EOF Then
Exit Sub
End If
Adodc1.Recordset.MoveFirst
While Not Adodc1.Recordset.EOF
If IsNull(Adodc1.Recordset.Fields(1).Value) Then
DoEvents
Else
Select Case Adodc1.Recordset.Fields(1).Value
Case "ãÌÑÏ"
intamar(10) = Adodc1.Recordset.Fields(0).Value
Case "ÇÒÏæÇÌ ãÌÏÏ", "ãÊÇåá"
intamar(11) = Adodc1.Recordset.Fields(0).Value
Case "ãØáÞå íÇ ãÊÇÑßå"
intamar(12) = Adodc1.Recordset.Fields(0).Value
Case "åãÓÑ ÝæÊ ßÑÏå"
intamar(13) = Adodc1.Recordset.Fields(0).Value
End Select
End If
Adodc1.Recordset.MoveNext
Wend
intamar(14) = intamar(10) + intamar(11) + intamar(12) + intamar(13)
'report for shoghle
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select count(shoghle),shoghle from moshtarydarmanjo WHERE tarikh_primary>='" & s & "'" & "AND tarikh_primary<='" & s1 & "'group by shoghle"
Adodc1.Refresh
If Adodc1.Recordset.BOF And Adodc1.Recordset.EOF Then
Exit Sub
End If
Adodc1.Recordset.MoveFirst
While Not Adodc1.Recordset.EOF
If IsNull(Adodc1.Recordset.Fields(1).Value) Then
DoEvents
Else
Select Case Adodc1.Recordset.Fields(1).Value
Case "ÏÇäÔ ÂãæÒ"
intamar(15) = Adodc1.Recordset.Fields(0).Value
Case "ÏÇäÔÌæ"
intamar(16) = Adodc1.Recordset.Fields(0).Value
Case "ÎÇäå ÏÇÑ"
intamar(17) = Adodc1.Recordset.Fields(0).Value
Case "ßæÏß", "ÈíßÇÑ"
intamar(18) = intamar(18) + Adodc1.Recordset.Fields(0).Value
Case "ÈÇÒäÔÓÊå"
intamar(19) = Adodc1.Recordset.Fields(0).Value
Case "ÔÇÛá ÏÑ ÈÎÔ ÏæáÊí"
intamar(20) = Adodc1.Recordset.Fields(0).Value
Case "ÔÇÛá ÏÑ ÈÎÔ ÎÕæÕí"
intamar(21) = Adodc1.Recordset.Fields(0).Value
End Select
End If
Adodc1.Recordset.MoveNext
Wend
intamar(22) = intamar(15) + intamar(16) + intamar(17) + intamar(18) + intamar(19) + intamar(20) + intamar(21)
'report for noe khadamat
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select count(khadamat),khadamat from moshtarydarmanjo WHERE tarikh_primary>='" & s & "'" & "AND tarikh_primary<='" & s1 & "'group by khadamat"
Adodc1.Refresh
If Adodc1.Recordset.BOF And Adodc1.Recordset.EOF Then
Exit Sub
End If
Adodc1.Recordset.MoveFirst
While Not Adodc1.Recordset.EOF
If IsNull(Adodc1.Recordset.Fields(1).Value) Then
DoEvents
Else
Select Case Adodc1.Recordset.Fields(1).Value
Case "ÝÑÏí"
intamar(23) = Adodc1.Recordset.Fields(0).Value
Case "Ñæåí"
intamar(24) = Adodc1.Recordset.Fields(0).Value
Case "ÎÇäæÇÏå"
intamar(25) = Adodc1.Recordset.Fields(0).Value
Case "ÒæÌ"
intamar(26) = Adodc1.Recordset.Fields(0).Value
Case "ãÏÏßÇÑí"
intamar(27) = Adodc1.Recordset.Fields(0).Value
Case "ßáÇÓ ÂãæÒÔí"
intamar(28) = Adodc1.Recordset.Fields(0).Value
Case "ÓÇíÑÎÏãÇÊ"
intamar(29) = Adodc1.Recordset.Fields(0).Value
End Select
End If
Adodc1.Recordset.MoveNext
Wend
intamar(30) = intamar(23) + intamar(24) + intamar(25) + intamar(26) + intamar(27) + intamar(28) + intamar(29)
'report for moshakhasat
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select count(elat_maraje),elat_maraje from moshtarydarmanjo WHERE tarikh_primary>='" & s & "'" & "AND tarikh_primary<='" & s1 & "'group by elat_maraje"
Adodc1.Refresh
If Adodc1.Recordset.BOF And Adodc1.Recordset.EOF Then
Exit Sub
End If
Adodc1.Recordset.MoveFirst
While Not Adodc1.Recordset.EOF
If IsNull(Adodc1.Recordset.Fields(1).Value) Then
DoEvents
Else
Select Case Adodc1.Recordset.Fields(1).Value
Case "ÇÎÊáÇáÇÊ ÑæÇäí", "ÇÝÓÑÏí", "ÇÖØÑÇÈ", "æÓæÇÓ"
intamar(31) = intamar(31) + Adodc1.Recordset.Fields(0).Value
Case "ãÔßáÇÊ ÎÇäæÇÏí"
intamar(32) = Adodc1.Recordset.Fields(0).Value
Case "ãÔßáÇÊ ÒäÇÔæíí"
intamar(33) = Adodc1.Recordset.Fields(0).Value
Case "ãÔßáÇÊ ÇÞÊÕÇÏí æ ÔÛáí"
intamar(34) = Adodc1.Recordset.Fields(0).Value
Case "ãÔßáÇÊ ÇÌÊãÇÚí æ ÈÒåßÇÑí"
intamar(35) = Adodc1.Recordset.Fields(0).Value
Case "ãÔßáÇÊ ÌäÓí"
intamar(36) = Adodc1.Recordset.Fields(0).Value
Case "ãÔßáÇÊ ãÑÊÈØ ÈÇ ÑæíÏÇÏåÇí ÇÓÊÑÓ ÒÇí ÒäÏí"
intamar(37) = Adodc1.Recordset.Fields(0).Value
Case "ÇÑÇÆå ÑÇåäãÇíí"
intamar(38) = Adodc1.Recordset.Fields(0).Value
Case "ãÔßáÇÊ ÊÍÕíáí"
intamar(39) = Adodc1.Recordset.Fields(0).Value
Case "ÇÚÊíÇÏ"
intamar(40) = Adodc1.Recordset.Fields(0).Value
Case "ÓÇíÑ ãæÇÑÏ"
intamar(41) = Adodc1.Recordset.Fields(0).Value
Case "ãÔßáÇÊ ßæÏßÇä"
intamar(42) = Adodc1.Recordset.Fields(0).Value
Case "ãÔÇæÑå ÇÒÏæÇÌ"
intamar(43) = Adodc1.Recordset.Fields(0).Value
End Select
End If
Adodc1.Recordset.MoveNext
Wend
intamar(44) = intamar(31) + intamar(32) + intamar(33) + intamar(34) + intamar(35) + intamar(36) + intamar(37) + intamar(38) + intamar(39) + intamar(40) + intamar(41) + intamar(42) + intamar(43)
'report noeshoghl
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select count(noe_shoghle), noe_shoghle from moshtarydarmanjo WHERE tarikh_primary>='" & s & "'" & "AND tarikh_primary<='" & s1 & "' group by noe_shoghle"
Adodc1.Refresh
If Adodc1.Recordset.BOF And Adodc1.Recordset.EOF Then
Exit Sub
End If
Adodc1.Recordset.MoveFirst
While Not Adodc1.Recordset.EOF
If IsNull(Adodc1.Recordset.Fields(1).Value) Then
DoEvents
Else
Select Case Adodc1.Recordset.Fields(1).Value
Case "æ"
intamar(45) = Adodc1.Recordset.Fields(0).Value
Case "Û"
intamar(46) = Adodc1.Recordset.Fields(0).Value
End Select
End If
Adodc1.Recordset.MoveNext
Wend
intamar(47) = intamar(45) + intamar(46)
Call insertrecord1
Adodc2.Refresh
cr5.ReportFileName = "C:\RAVANPOYA\report\rcenter.rpt"
cr5.RetrieveDataFiles
cr5.SelectionFormula = "{report.f1}>=0"
cr5.Action = 1
Command2.Enabled = False
Timer1.Enabled = True
End Sub
Private Sub Command6_Click()
strreport = "C:\RAVANPOYA\report\rbd.rpt"
q = "bedehkar"
Call report
End Sub
Private Sub report()
Dim s As String, s1 As String
Dim d As Date, d1 As Date
s = Text1 & "/" & Text2 & "/" & Text3
s1 = Text4 & "/" & Text5 & "/" & Text6
If Not IsDate(s) Or Not IsDate(s1) Then Exit Sub
d = CDate(s)
d1 = CDate(s1)
s = CStr(d)
s1 = CStr(d1)
cr5.ReportFileName = strreport
cr5.RetrieveDataFiles
cr5.SelectionFormula = "{" & q & ".tarikh}>= '" & s & "'" & "and {" & q & ".tarikh} <='" & s1 & "'"
cr5.Action = 1
End Sub
Private Sub Command7_Click()
Dim rdoctor(1 To 13) As String
Dim HOUR1 As String, MINUTES1 As String
Dim s As String, s1 As String
Dim d As Date, d1 As Date
s = Text1 & "/" & Text2 & "/" & Text3
s1 = Text4 & "/" & Text5 & "/" & Text6
If Not IsDate(s) Or Not IsDate(s1) Then Exit Sub
d = CDate(s)
d1 = CDate(s1)
s = CStr(d)
s1 = CStr(d1)
Command7.Enabled = False
'report for drdarmangar
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select name,sum(saat_kar),count(roz),sum(saat_class) from drdarmangar WHERE tarikh>='" & s & "'" & "AND tarikh<='" & s1 & "' group by name"
Adodc1.Refresh
If Adodc1.Recordset.BOF And Adodc1.Recordset.EOF Then
Exit Sub
End If
Adodc1.Recordset.MoveFirst
While Not Adodc1.Recordset.EOF
Adodc3.Recordset.AddNew
Adodc3.Recordset.Fields(1).Value = Adodc1.Recordset.Fields(0).Value
HOUR1 = Str(Val(Adodc1.Recordset.Fields(1).Value) \ 60)
MINUTES1 = Str(Val(Adodc1.Recordset.Fields(1).Value) Mod 60)
If MINUTES1 < 10 Then
MINUTES1 = "0" + MINUTES1
End If
Adodc3.Recordset.Fields(2).Value = HOUR1 + ":" + MINUTES1
Adodc3.Recordset.Fields(3).Value = Adodc1.Recordset.Fields(2).Value
Adodc3.Recordset.Fields(8).Value = Adodc1.Recordset.Fields(3).Value
Select Case Adodc1.Recordset.Fields(0).Value
Case "ÈÑÌÚáí"
Adodc3.Recordset.Fields(11).Value = CStr(Int(Val(Adodc1.Recordset.Fields(1).Value) * 160000 / 60))
Case "ÇÕÛÑ äŽÇÏ"
Adodc3.Recordset.Fields(11).Value = CStr(Int(Val(Adodc1.Recordset.Fields(1).Value) * 120000 / 60))
Case "ÈÎÊíÇÑí"
Adodc3.Recordset.Fields(11).Value = CStr(Int(Val(Adodc1.Recordset.Fields(1).Value) * 60000 / 60))
Case "ÓÚíÏí"
Adodc3.Recordset.Fields(11).Value = CStr(Int(Val(Adodc1.Recordset.Fields(1).Value) * 120000 / 60))
Case "ÈÇÈÇíí"
Adodc3.Recordset.Fields(11).Value = CStr(Int(Val(Adodc1.Recordset.Fields(1).Value) * 45000 / 60))
Case "ÚÇãÑí"
Adodc3.Recordset.Fields(11).Value = CStr(Int(Val(Adodc1.Recordset.Fields(1).Value) * 60000 / 60))
Case "ÇÓãÇÚíáí"
Adodc3.Recordset.Fields(11).Value = CStr(Int(Val(Adodc1.Recordset.Fields(1).Value) * 120000 / 60))
Case "ËÇÈÊ"
Adodc3.Recordset.Fields(11).Value = CStr(Int(Val(Adodc1.Recordset.Fields(1).Value) * 80000 / 60))
Case "ÚÏÇáÊí"
Adodc3.Recordset.Fields(11).Value = CStr(Int(Val(Adodc1.Recordset.Fields(1).Value) * 200000 / 60))
Case "ãíÑÒÇíí"
Adodc3.Recordset.Fields(11).Value = CStr(Int(Val(Adodc1.Recordset.Fields(1).Value) * 45000 / 60))
End Select
Adodc3.Recordset.Fields(4).Value = 0
Adodc3.Recordset.Fields(5).Value = 0
Adodc3.Recordset.Fields(6).Value = 0
Adodc3.Recordset.Fields(7).Value = 0
Adodc3.Recordset.Fields(9).Value = 0
Adodc3.Recordset.Fields(10).Value = 0
Adodc3.Recordset.Fields(12).Value = s
Adodc3.Recordset.Fields(13).Value = s1
Adodc3.Recordset.Update
Adodc1.Recordset.MoveNext
Wend
Sleep 2000
'For k = 1 To 2000
' DoEvents
'Next
'adodc3.CommandType = adCmdTable
'adodc3.RecordSource = "reportdoctor"
'report for saat
Adodc3.Refresh
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select darmangar,SUM(modate_moshavere),COUNT(shomare_parvande),SUM(hazine_daryafti_moshavere),SUM(hazine_daryafti_test),SUM(bedehkar),SUM(kol_daryafti) from fine WHERE tarikh>='" & s & "'" & "AND tarikh<='" & s1 & "' group by darmangar"
Adodc1.Refresh
If Adodc1.Recordset.BOF And Adodc1.Recordset.EOF Then
Exit Sub
End If
' Adodc1.Recordset.MoveFirst
'While Not Adodc1.Recordset.EOF
' If Not IsNull(Adodc1.Recordset.Fields(0).Value) Then
' List1.AddItem Adodc1.Recordset.Fields(0).Value
' Else
' List1.AddItem " "
' End If
' Adodc1.Recordset.MoveNext
'Wend
Adodc1.Recordset.MoveFirst
Adodc3.Recordset.MoveFirst
For i = 1 To Adodc1.Recordset.RecordCount
If Not IsNull(Adodc1.Recordset.Fields(0).Value) Then
Adodc3.Recordset.Find "f1='" & Adodc1.Recordset.Fields(0).Value & "'"
If Adodc3.Recordset.EOF Then
DoEvents
Else
'Adodc3.Recordset.Fields(4).Value = CStr(Adodc1.Recordset.Fields(1).Value)
Adodc3.Recordset.Fields(5).Value = CStr(Adodc1.Recordset.Fields(2).Value)
Adodc3.Recordset.Fields(6).Value = CStr(Adodc1.Recordset.Fields(3).Value)
Adodc3.Recordset.Fields(7).Value = CStr(Adodc1.Recordset.Fields(4).Value)
Adodc3.Recordset.Fields(9).Value = CStr(Adodc1.Recordset.Fields(5).Value)
Adodc3.Recordset.Fields(10).Value = CStr(Adodc1.Recordset.Fields(6).Value)
Adodc3.Recordset.Fields(4).Value = CStr(Adodc1.Recordset.Fields(6).Value - Adodc1.Recordset.Fields(5).Value)
If Adodc3.Recordset.Fields(1).Value = "ÈÇÈÇíí" Then
Adodc3.Recordset.Fields(11).Value = 55000 * Val(Adodc3.Recordset.Fields(5).Value)
End If
If Adodc3.Recordset.Fields(1).Value = "ãíÑÒÇíí" Then
Adodc3.Recordset.Fields(11).Value = 50000 * Val(Adodc3.Recordset.Fields(5).Value)
End If
Adodc3.Recordset.Update
Adodc3.Recordset.MoveFirst
End If
End If
Adodc1.Recordset.MoveNext
Adodc3.Recordset.MoveFirst
Next
' For k = 1 To 2000
' DoEvents
' Next
Sleep 2000
'*****************
If dc1.Text = "" Then
cr5.ReportFileName = "C:\RAVANPOYA\report\rdoctor11.rpt"
cr5.RetrieveDataFiles
cr5.SelectionFormula = "{reportdoctor.row}>=0"
cr5.Action = 1
Else
cr5.ReportFileName = "C:\RAVANPOYA\report\rdoctor11.rpt"
cr5.RetrieveDataFiles
cr5.SelectionFormula = "{reportdoctor.f1}='" & dc1.Text & "'"
cr5.Action = 1
End If
'For k = 1 To 2000
' DoEvents
'Next
Sleep 2000
Adodc3.Recordset.MoveFirst
While Not Adodc3.Recordset.EOF
Adodc3.Recordset.Delete
Adodc3.Recordset.MoveNext
Wend
Sleep 2000
Command7.Enabled = True
End Sub
Private Sub Form_Load()
Unload Form2
VBA.Calendar = vbCalHijri
End Sub
'******************************************************************
'******************report for behzisti ****************************
'******************************************************************
Private Sub Command5_Click()
Dim s As String, s1 As String
Dim d As Date, d1 As Date
s = Text1 & "/" & Text2 & "/" & Text3
s1 = Text4 & "/" & Text5 & "/" & Text6
If Not IsDate(s) Or Not IsDate(s1) Then Exit Sub
d = CDate(s)
d1 = CDate(s1)
s = CStr(d)
s1 = CStr(d1)
'report for gender
For i = 1 To 44
intamar(i) = 0
Next
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select count(gender), gender from reportfine WHERE tarikh>='" & s & "'" & "AND tarikh<='" & s1 & "' group by gender"
Adodc1.Refresh
If Adodc1.Recordset.BOF And Adodc1.Recordset.EOF Then
Exit Sub
End If
Adodc1.Recordset.MoveFirst
While Not Adodc1.Recordset.EOF
If IsNull(Adodc1.Recordset.Fields(1).Value) Then
DoEvents
Else
Select Case Adodc1.Recordset.Fields(1).Value
Case "ãÐßÑ"
intamar(2) = Adodc1.Recordset.Fields(0).Value
Case "ãæäË"
intamar(1) = Adodc1.Recordset.Fields(0).Value
End Select
End If
Adodc1.Recordset.MoveNext
Wend
intamar(3) = intamar(1) + intamar(2)
'report for tahsilat
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select count(modrak_tahsili),modrak_tahsili from reportfine WHERE tarikh>='" & s & "'" & "AND tarikh<='" & s1 & "'group by modrak_tahsili"
Adodc1.Refresh
If Adodc1.Recordset.BOF And Adodc1.Recordset.EOF Then
Exit Sub
End If
Adodc1.Recordset.MoveFirst
While Not Adodc1.Recordset.EOF
If IsNull(Adodc1.Recordset.Fields(1).Value) Then
DoEvents
Else
Select Case Adodc1.Recordset.Fields(1).Value
Case "ÈíÓæÇÏ"
intamar(4) = Adodc1.Recordset.Fields(0).Value
Case "ÎæÇäÏä æ äæÔÊä"
intamar(5) = Adodc1.Recordset.Fields(0).Value
Case "ÑÇåäãÇíí æÓíßá"
intamar(6) = Adodc1.Recordset.Fields(0).Value
Case "Ïíáã", "íÔ ÏÇäÔÇåí íÇ Ïíáã"
intamar(7) = intamar(7) + Adodc1.Recordset.Fields(0).Value
Case "ÏßÊÑÇ", "ÝæÞ áíÓÇäÓ", "áíÓÇäÓ", "ÝæÞ Ïíáã"
intamar(8) = intamar(8) + Adodc1.Recordset.Fields(0).Value
End Select
End If
Adodc1.Recordset.MoveNext
Wend
intamar(9) = intamar(4) + intamar(5) + intamar(6) + intamar(7) + intamar(8)
'report for vaseat tahol
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select count(v_taahole),v_taahole from reportfine WHERE tarikh>='" & s & "'" & "AND tarikh<='" & s1 & "'group by v_taahole"
Adodc1.Refresh
If Adodc1.Recordset.BOF And Adodc1.Recordset.EOF Then
Exit Sub
End If
Adodc1.Recordset.MoveFirst
While Not Adodc1.Recordset.EOF
If IsNull(Adodc1.Recordset.Fields(1).Value) Then
DoEvents
Else
Select Case Adodc1.Recordset.Fields(1).Value
Case "ãÌÑÏ"
intamar(10) = Adodc1.Recordset.Fields(0).Value
Case "ÇÒÏæÇÌ ãÌÏÏ", "ãÊÇåá"
intamar(11) = Adodc1.Recordset.Fields(0).Value
Case "ãØáÞå íÇ ãÊÇÑßå"
intamar(12) = Adodc1.Recordset.Fields(0).Value
Case "åãÓÑ ÝæÊ ßÑÏå"
intamar(13) = Adodc1.Recordset.Fields(0).Value
End Select
End If
Adodc1.Recordset.MoveNext
Wend
intamar(14) = intamar(10) + intamar(11) + intamar(12) + intamar(13)
'report for shoghle
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select count(shoghle),shoghle from reportfine WHERE tarikh>='" & s & "'" & "AND tarikh<='" & s1 & "'group by shoghle"
Adodc1.Refresh
If Adodc1.Recordset.BOF And Adodc1.Recordset.EOF Then
Exit Sub
End If
Adodc1.Recordset.MoveFirst
While Not Adodc1.Recordset.EOF
If IsNull(Adodc1.Recordset.Fields(1).Value) Then
DoEvents
Else
Select Case Adodc1.Recordset.Fields(1).Value
Case "ÏÇäÔ ÂãæÒ"
intamar(15) = Adodc1.Recordset.Fields(0).Value
Case "ÏÇäÔÌæ"
intamar(16) = Adodc1.Recordset.Fields(0).Value
Case "ÎÇäå ÏÇÑ"
intamar(17) = Adodc1.Recordset.Fields(0).Value
Case "ßæÏß", "ÈíßÇÑ"
intamar(18) = intamar(18) + Adodc1.Recordset.Fields(0).Value
Case "ÈÇÒäÔÓÊå"
intamar(19) = Adodc1.Recordset.Fields(0).Value
Case "ÔÇÛá ÏÑ ÈÎÔ ÏæáÊí"
intamar(20) = Adodc1.Recordset.Fields(0).Value
Case "ÔÇÛá ÏÑ ÈÎÔ ÎÕæÕí"
intamar(21) = Adodc1.Recordset.Fields(0).Value
End Select
End If
Adodc1.Recordset.MoveNext
Wend
intamar(22) = intamar(15) + intamar(16) + intamar(17) + intamar(18) + intamar(19) + intamar(20) + intamar(21)
'report for noe khadamat
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select count(khadamat),khadamat from reportfine WHERE tarikh>='" & s & "'" & "AND tarikh<='" & s1 & "'group by khadamat"
Adodc1.Refresh
If Adodc1.Recordset.BOF And Adodc1.Recordset.EOF Then
Exit Sub
End If
Adodc1.Recordset.MoveFirst
While Not Adodc1.Recordset.EOF
If IsNull(Adodc1.Recordset.Fields(1).Value) Then
DoEvents
Else
Select Case Adodc1.Recordset.Fields(1).Value
Case "ÝÑÏí"
intamar(23) = Adodc1.Recordset.Fields(0).Value
Case "Ñæåí"
intamar(24) = Adodc1.Recordset.Fields(0).Value
Case "ÎÇäæÇÏå"
intamar(25) = Adodc1.Recordset.Fields(0).Value
Case "ÒæÌ"
intamar(26) = Adodc1.Recordset.Fields(0).Value
Case "ãÏÏßÇÑí"
intamar(27) = Adodc1.Recordset.Fields(0).Value
Case "ßáÇÓ ÂãæÒÔí"
intamar(28) = Adodc1.Recordset.Fields(0).Value
Case "ÓÇíÑÎÏãÇÊ"
intamar(29) = Adodc1.Recordset.Fields(0).Value
End Select
End If
Adodc1.Recordset.MoveNext
Wend
intamar(30) = intamar(23) + intamar(24) + intamar(25) + intamar(26) + intamar(27) + intamar(28) + intamar(29)
'report for moshakhasat
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select count(elat_maraje),elat_maraje from reportfine WHERE tarikh>='" & s & "'" & "AND tarikh<='" & s1 & "'group by elat_maraje"
Adodc1.Refresh
If Adodc1.Recordset.BOF And Adodc1.Recordset.EOF Then
Exit Sub
End If
Adodc1.Recordset.MoveFirst
While Not Adodc1.Recordset.EOF
If IsNull(Adodc1.Recordset.Fields(1).Value) Then
DoEvents
Else
Select Case Adodc1.Recordset.Fields(1).Value
Case "ÇÎÊáÇáÇÊ ÑæÇäí", "ÇÝÓÑÏí", "ÇÖØÑÇÈ", "æÓæÇÓ"
intamar(31) = intamar(31) + Adodc1.Recordset.Fields(0).Value
Case "ãÔßáÇÊ ÎÇäæÇÏí"
intamar(32) = Adodc1.Recordset.Fields(0).Value
Case "ãÔßáÇÊ ÒäÇÔæíí"
intamar(33) = Adodc1.Recordset.Fields(0).Value
Case "ãÔßáÇÊ ÇÞÊÕÇÏí æ ÔÛáí"
intamar(34) = Adodc1.Recordset.Fields(0).Value
Case "ãÔßáÇÊ ÇÌÊãÇÚí æ ÈÒåßÇÑí"
intamar(35) = Adodc1.Recordset.Fields(0).Value
Case "ãÔßáÇÊ ÌäÓí"
intamar(36) = Adodc1.Recordset.Fields(0).Value
Case "ãÔßáÇÊ ãÑÊÈØ ÈÇ ÑæíÏÇÏåÇí ÇÓÊÑÓ ÒÇí ÒäÏí"
intamar(37) = Adodc1.Recordset.Fields(0).Value
Case "ÇÑÇÆå ÑÇåäãÇíí"
intamar(38) = Adodc1.Recordset.Fields(0).Value
Case "ãÔßáÇÊ ÊÍÕíáí"
intamar(39) = Adodc1.Recordset.Fields(0).Value
Case "ÇÚÊíÇÏ"
intamar(40) = Adodc1.Recordset.Fields(0).Value
Case "ÓÇíÑ ãæÇÑÏ"
intamar(41) = Adodc1.Recordset.Fields(0).Value
Case "ãÔßáÇÊ ßæÏßÇä"
intamar(42) = Adodc1.Recordset.Fields(0).Value
Case "ãÔÇæÑå ÇÒÏæÇÌ"
intamar(43) = Adodc1.Recordset.Fields(0).Value
End Select
End If
Adodc1.Recordset.MoveNext
Wend
intamar(44) = intamar(31) + intamar(32) + intamar(33) + intamar(34) + intamar(35) + intamar(36) + intamar(37) + intamar(38) + intamar(39) + intamar(40) + intamar(41) + intamar(42) + intamar(43)
Call insertrecord
Adodc2.Refresh
cr5.ReportFileName = "C:\RAVANPOYA\report\rmainmain.rpt"
cr5.RetrieveDataFiles
cr5.SelectionFormula = "{report.f1}>=0"
cr5.Action = 1
'cr5.SelectionFormula = "{report.f1}>=0"
Command5.Enabled = False
Timer1.Enabled = True
'Command5.Enabled = False
' adodc2.Recordset.MoveFirst
' adodc2.Recordset.Delete
'adodc2.Recordset.MoveNext
End Sub
Private Sub insertrecord()
Dim s As String, s1 As String
Dim d As Date, d1 As Date
s = Text1 & "/" & Text2 & "/" & Text3
s1 = Text4 & "/" & Text5 & "/" & Text6
If Not IsDate(s) Or Not IsDate(s1) Then Exit Sub
d = CDate(s)
d1 = CDate(s1)
s = CStr(d)
s1 = CStr(d1)
Adodc2.Recordset.AddNew
Adodc2.Recordset.Fields(0).Value = Right(s1, 8) & "-" & Right(s, 8)
Adodc2.Recordset.Fields(1).Value = intamar(1)
Adodc2.Recordset.Fields(2).Value = intamar(2)
Adodc2.Recordset.Fields(3).Value = intamar(3)
Adodc2.Recordset.Fields(4).Value = intamar(4)
Adodc2.Recordset.Fields(5).Value = intamar(5)
Adodc2.Recordset.Fields(6).Value = intamar(6)
Adodc2.Recordset.Fields(7).Value = intamar(7)
Adodc2.Recordset.Fields(8).Value = intamar(8)
Adodc2.Recordset.Fields(9).Value = intamar(9)
Adodc2.Recordset.Fields(10).Value = intamar(10)
Adodc2.Recordset.Fields(11).Value = intamar(11)
Adodc2.Recordset.Fields(12).Value = intamar(12)
Adodc2.Recordset.Fields(13).Value = intamar(13)
Adodc2.Recordset.Fields(14).Value = intamar(14)
Adodc2.Recordset.Fields(15).Value = intamar(15)
Adodc2.Recordset.Fields(16).Value = intamar(16)
Adodc2.Recordset.Fields(17).Value = intamar(17)
Adodc2.Recordset.Fields(18).Value = intamar(18)
Adodc2.Recordset.Fields(19).Value = intamar(19)
Adodc2.Recordset.Fields(20).Value = intamar(20)
Adodc2.Recordset.Fields(21).Value = intamar(21)
Adodc2.Recordset.Fields(22).Value = intamar(22)
Adodc2.Recordset.Fields(23).Value = intamar(23)
Adodc2.Recordset.Fields(24).Value = intamar(24)
Adodc2.Recordset.Fields(25).Value = intamar(25)
Adodc2.Recordset.Fields(26).Value = intamar(26)
Adodc2.Recordset.Fields(27).Value = intamar(27)
Adodc2.Recordset.Fields(28).Value = intamar(28)
Adodc2.Recordset.Fields(29).Value = intamar(29)
Adodc2.Recordset.Fields(30).Value = intamar(30)
Adodc2.Recordset.Fields(31).Value = intamar(31)
Adodc2.Recordset.Fields(32).Value = intamar(32)
Adodc2.Recordset.Fields(33).Value = intamar(33)
Adodc2.Recordset.Fields(34).Value = intamar(34)
Adodc2.Recordset.Fields(35).Value = intamar(35)
Adodc2.Recordset.Fields(36).Value = intamar(36)
Adodc2.Recordset.Fields(37).Value = intamar(37)
Adodc2.Recordset.Fields(38).Value = intamar(38)
Adodc2.Recordset.Fields(39).Value = intamar(39)
Adodc2.Recordset.Fields(40).Value = intamar(40)
Adodc2.Recordset.Fields(41).Value = intamar(41)
Adodc2.Recordset.Fields(42).Value = intamar(42)
Adodc2.Recordset.Fields(43).Value = intamar(43)
Adodc2.Recordset.Fields(44).Value = intamar(44)
Adodc2.Recordset.Update
End Sub
Private Sub Timer1_Timer()
Adodc2.Refresh
Command5.Enabled = True
Command1.Enabled = True
Command2.Enabled = True
If Adodc2.Recordset.BOF And Adodc2.Recordset.EOF Then
Exit Sub
End If
Adodc2.Recordset.MoveFirst
Adodc2.Recordset.Delete
Command5.Enabled = True
Command1.Enabled = True
Command2.Enabled = True
Timer1.Enabled = False
End Sub
Private Sub insertrecord1()
Dim s As String, s1 As String
Dim d As Date, d1 As Date
s = Text1 & "/" & Text2 & "/" & Text3
s1 = Text4 & "/" & Text5 & "/" & Text6
If Not IsDate(s) Or Not IsDate(s1) Then Exit Sub
d = CDate(s)
d1 = CDate(s1)
s = CStr(d)
s1 = CStr(d1)
Adodc2.Recordset.AddNew
Adodc2.Recordset.Fields(0).Value = Right(s1, 8) & "-" & Right(s, 8)
Adodc2.Recordset.Fields(1).Value = intamar(1)
Adodc2.Recordset.Fields(2).Value = intamar(2)
Adodc2.Recordset.Fields(3).Value = intamar(3)
Adodc2.Recordset.Fields(4).Value = intamar(4)
Adodc2.Recordset.Fields(5).Value = intamar(5)
Adodc2.Recordset.Fields(6).Value = intamar(6)
Adodc2.Recordset.Fields(7).Value = intamar(7)
Adodc2.Recordset.Fields(8).Value = intamar(8)
Adodc2.Recordset.Fields(9).Value = intamar(9)
Adodc2.Recordset.Fields(10).Value = intamar(10)
Adodc2.Recordset.Fields(11).Value = intamar(11)
Adodc2.Recordset.Fields(12).Value = intamar(12)
Adodc2.Recordset.Fields(13).Value = intamar(13)
Adodc2.Recordset.Fields(14).Value = intamar(14)
Adodc2.Recordset.Fields(15).Value = intamar(15)
Adodc2.Recordset.Fields(16).Value = intamar(16)
Adodc2.Recordset.Fields(17).Value = intamar(17)
Adodc2.Recordset.Fields(18).Value = intamar(18)
Adodc2.Recordset.Fields(19).Value = intamar(19)
Adodc2.Recordset.Fields(20).Value = intamar(20)
Adodc2.Recordset.Fields(21).Value = intamar(21)
Adodc2.Recordset.Fields(22).Value = intamar(22)
Adodc2.Recordset.Fields(23).Value = intamar(23)
Adodc2.Recordset.Fields(24).Value = intamar(24)
Adodc2.Recordset.Fields(25).Value = intamar(25)
Adodc2.Recordset.Fields(26).Value = intamar(26)
Adodc2.Recordset.Fields(27).Value = intamar(27)
Adodc2.Recordset.Fields(28).Value = intamar(28)
Adodc2.Recordset.Fields(29).Value = intamar(29)
Adodc2.Recordset.Fields(30).Value = intamar(30)
Adodc2.Recordset.Fields(31).Value = intamar(31)
Adodc2.Recordset.Fields(32).Value = intamar(32)
Adodc2.Recordset.Fields(33).Value = intamar(33)
Adodc2.Recordset.Fields(34).Value = intamar(34)
Adodc2.Recordset.Fields(35).Value = intamar(35)
Adodc2.Recordset.Fields(36).Value = intamar(36)
Adodc2.Recordset.Fields(37).Value = intamar(37)
Adodc2.Recordset.Fields(38).Value = intamar(38)
Adodc2.Recordset.Fields(39).Value = intamar(39)
Adodc2.Recordset.Fields(40).Value = intamar(40)
Adodc2.Recordset.Fields(41).Value = intamar(41)
Adodc2.Recordset.Fields(42).Value = intamar(42)
Adodc2.Recordset.Fields(43).Value = intamar(43)
Adodc2.Recordset.Fields(44).Value = intamar(44)
Adodc2.Recordset.Fields(45).Value = intamar(45)
Adodc2.Recordset.Fields(46).Value = intamar(46)
Adodc2.Recordset.Fields(47).Value = intamar(47)
Adodc2.Recordset.Update
End Sub
سلام
من توی فرم دیگه باز با همون مشکل ربرو شدم همون ران تایم 94
نمی دونم این چه بلایی سر ما اومده
ممنونم که راهنماییم می کنید
کد باگ
کد:Adodc3.Recordset.Fields(7).Value = CStr(Adodc1.Recordset.Fields(4).Value)
Adodc3.Recordset.Fields(7).Value = CStr(Adodc1.Recordset.Fields(4).Value)
If IsNull(Adodc1.Recordset.Fields(4).Value) = False Then
Adodc3.Recordset.Fields(7).Value = CStr(Adodc1.Recordset.Fields(4).Value)
Else
Adodc3.Recordset.Fields(7).Value = ""
End If
آقا ممنون- این برنامه رو من ننوشتم یه بنده خدا 10 سال پیش نوشته من هیچی سر در نمی یارم چطور می شه این
null
را تبدیل به
string
کرد
بازم ممنونم.
Private Function ToString(ByVal Value As Variant) As String
If IsNull(Value) Then
ToString = ""
Else
ToString = CStr(Value)
End If
End Function
Adodc3.Recordset.Fields(5).Value = CStr(Adodc1.Recordset.Fields(2).Value)
Adodc3.Recordset.Fields(5).Value = ToString(Adodc1.Recordset.Fields(2).Value)
[/code]موقعیت آن خطا روی کدوم سطر است؟
[B]SYMPTOMS[/B]
If you use ADO to insert a new record through a client-side recordset into a SQL
Server table that has a non-nullable datetime field with a default value,
you receive the following error message if you do not supply a value for the datetime field:
Run-time error '-2147217887 (80040e21)': Multiple-step operation generated errors. Check each status value.
This error occurs whether you use the OLE DB Provider for SQL Server
or the OLE DB Provider for ODBC Drivers.
The error message may differ when you use
Microsoft Data Access Components (MDAC) version 2.5 Service Pack 1 (SP1) or earlier.
This error does not occur with a server-side cursor.
[B]RESOLUTION[/B]
There are several ways to work around this problem:
Use a server-side cursor for the recordset.
Remove the default value that is specified for the field in the database.
Always specify a value for the field when you add a new record.
Private Sub cmdok_Click()
Dim X As Integer
tarikhjo = CDate(text2.Text)
Adodc1.Recordset(1).Value = CStr(tarikhjo)
On Error Resume Next
Adodc1.Recordset.Update
If Err <> 0 Then
MsgBox "Error " & Err.Number & " :" & vbNewLine & Err.Description
' X = MsgBox("ÔãÇÑå ÑæäÏå æÌæÏ äÏÇÑÏ", , "ÎØÇ")
Exit Sub
End If
Call hidebutton
Call lockedfield
End Sub