الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

الرجاء المساعدة في التقرير

بدأه محمد عثمان في 31 مارس 2010 · 4 رد · 551 مشاهدة · في لغة Ms Visual Basic 6 وما قبلها من إصدارات
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلام عليكم

قمت ببرمجة برنامج لنظام الارشيف التلفزيوني

وقمت بوضع ترقيم متسلسل ( رقم الكاسيت ) لكن المشلكة التي تواجهني في التقرير والطباعة انه يصبح الترقيم غير مرتب

(( قاعدة البيانات اكسس )) وعند الدخول الى قاعدة البيانات داخل الجدول يكون التسلسل مرتب

صورة للمشكلة

mos.jpg

ارجو الافادة من الاعضاء

#2

قم بتعديل جملة SQL بالترتيب حسب ماتود

مثال :

SQL="Select * from myTable OrderBy ID,Categery";

تحياتي

تم تعديل هذه المشاركة بواسطة omani في 31 مارس 2010 في 01:03

OMANI FOR EVER

-------------------------------------------------

post-12787-12780191801974.jpg

-------------------------------------------------

#3

هذا الكود لفورم التقرير ... ارجو التوضيح اين مكان التعديل مع الشكر


Dim ReportRS As New ADODB.Recordset
'
Private Sub Command1_Click()
'

'
If Option1.Value = True Then
'
If ReportRS.State = adStateOpen Then ReportRS.Close
'
If Trim(Text2.Text) = "" Then
ReportRS.Open "SELECT * FROM [ÇáÑæíÏ] WHERE [" & Combo1.Text & "] ='" & Trim(Text1.Text) & "'", db, adOpenStatic, adLockReadOnly
Else
ReportRS.Open "SELECT * FROM [ÇáÑæíÏ] WHERE [" & Combo1.Text & "] ='" & Trim(Text1.Text) & "' OR [" & Combo1.Text & "] = '" & Trim(Text2.Text) & "'", db, adOpenStatic, adLockReadOnly
End If
'
Call ShowResult
Else
'
If ReportRS.State = adStateOpen Then ReportRS.Close
'
If Trim(Text2.Text) = "" Then
ReportRS.Open "SELECT * FROM [ÇáÑæíÏ] WHERE [" & Combo1.Text & "] ='" & Trim(Text1.Text) & "'", db, adOpenStatic, adLockReadOnly
Else
ReportRS.Open "SELECT * FROM [ÇáÑæíÏ] WHERE [" & Combo1.Text & "] ='" & Trim(Text1.Text) & "' AND [" & Combo1.Text & "] ='" & Trim(Text2.Text) & "'", db, adOpenStatic, adLockReadOnly
End If
'
Call ShowResult
End If
End Sub
'
Private Sub Command2_Click()
'
If ReportRS.State = adStateOpen Then ReportRS.Close
ReportRS.Open "[ÇáÑæíÏ]", db, adOpenStatic, adLockReadOnly
'
Call ShowResult
End Sub
'
Private Sub Command3_Click()
'
Set DataReport1.DataSource = ReportRS
DataReport1.Show 1
End Sub
'
Private Sub Command4_Click()
'
Call Form_Unload(0)
End Sub
'
Private Sub Form_KeyPress(KeyAscii As Integer)
'
If KeyAscii = 27 Then
KeyAscii = 0
Call Form_Unload(0)
End If
End Sub
'
Private Sub Form_Load()
'
MDIMain.Skin2.ApplySkin Me.hwnd
'
If db.State = adStateClosed Then Call OpenDataBase
If ReportRS.State = adStateOpen Then ReportRS.Close
ReportRS.Open "[ÇáÑæíÏ]", db, adOpenStatic, adLockReadOnly
'
For i = 1 To ReportRS.Fields.Count - 4
Combo1.AddItem ReportRS.Fields(i).Name
Next i
'
MSFlexGrid1.Cols = ReportRS.Fields.Count - 3
'
For i = 0 To ReportRS.Fields.Count - 4
MSFlexGrid1.ColWidth(i) = 2000
MSFlexGrid1.ColAlignment(i) = 3
MSFlexGrid1.TextMatrix(0, i) = ReportRS.Fields(i).Name
Next i
'
Call Command2_Click
'
Combo1.Text = Combo1.List(0)
End Sub
'
Private Sub Form_Resize()
'
Me.Left = MDIMain.ScaleWidth / 2 - Me.Width / 2
Me.Top = MDIMain.ScaleHeight / 2 - Me.Height / 2
End Sub
'
Private Sub Form_Unload(cancel As Integer)
'
Unload Me
'
MDIMain.Frame2.Visible = False
Call OffOnButton(False)
Call RecordLenght
Call ReadFields
frmPhoneData.Show
End Sub
'
Private Sub Frame1_DragDrop(Source As Control, X As Single, Y As Single)
'
End Sub
'
Private Sub ShowResult()
'
i = 0
MSFlexGrid1.Rows = 1
'
If ReportRS.EOF = False Then
ReportRS.MoveFirst
Do While Not ReportRS.EOF
i = i + 1
MSFlexGrid1.Rows = i + 1
For d = 0 To ReportRS.Fields.Count - 4
If Not IsNull(ReportRS.Fields(d).Value) Then _
MSFlexGrid1.TextMatrix(i, d) = ReportRS.Fields(d).Value
Next d
ReportRS.MoveNext
Loop
End If
End Sub
'
Private Sub MSFlexGrid1_DblClick()
'
If MSFlexGrid1.Row = 0 Then Exit Sub
If MSFlexGrid1.Col = 0 Then Exit Sub
'
'
Call ShowResult
End Sub
'
Private Sub Text1_GotFocus()
'
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
End Sub
'
Private Sub Text2_GotFocus()
'
Text2.SelStart = 0
Text2.SelLength = Len(Text2.Text)
End Sub
'

#4

تفضل اخي الكريم التعديل

أنا وضعت اسم الجدول Mytable يجب ان تقوم بتغييره الى اسم الجدول الموجود لديك وأعتقد انك وضعت اسمه بالعربي

بالنسبة للحقول feildName1,feildName2 يجب ان تقوم بتغييرها الى اسماء الحقول لديك في الجدول .

مثلا تريد ان تقوم بالفرز حسب الفئة أولا ثم ترقم الفئة حسب التسلسل . هنا تختار حقل الفئة أولا ثم حقل الترقيم في نهاية جملة الاستعلام . بعد كلمة Order By

'
 Dim ReportRS As New ADODB.Recordset
'
Private Sub Command1_Click()
'

'
 If Option1.Value = True Then
'
     If ReportRS.State = adStateOpen Then ReportRS.Close
'
     If Trim(Text2.Text) = "" Then
        ReportRS.Open "SELECT * FROM [MyTable] " & _
        " WHERE [" & Combo1.Text & "] ='" & Trim(Text1.Text) & "' Order by Feild_Name1,feild_name2 "" &" _
        , db, adOpenStatic, adLockReadOnly
     Else
        ReportRS.Open "SELECT * FROM [MyTable] " & _
        " WHERE [" & Combo1.Text & "] ='" & Trim(Text1.Text) & "'" & _
        " OR [" & Combo1.Text & "] = '" & Trim(Text2.Text) & "' Order By FeildName1,FeildName2 " & "" _
        , db, adOpenStatic, adLockReadOnly
     End If
'
     Call ShowResult
  Else
'
     If ReportRS.State = adStateOpen Then ReportRS.Close
'
     If Trim(Text2.Text) = "" Then
        ReportRS.Open "SELECT * FROM [MyTable] WHERE [" & Combo1.Text & "] ='" & Trim(Text1.Text) & "' " & _
        " Order by FeildName ", db, adOpenStatic, adLockReadOnly
     Else
        ReportRS.Open "SELECT * FROM [MyTable] WHERE [" & Combo1.Text & "] ='" & Trim(Text1.Text) & "' " & _
         " AND [" & Combo1.Text & "] ='" & Trim(Text2.Text) & "'" & _
         " Order by FeildName1,FeildName2 ", db, adOpenStatic, adLockReadOnly
     End If
'
     Call ShowResult
 End If
End Sub
'
Private Sub Command2_Click()
'
 If ReportRS.State = adStateOpen Then ReportRS.Close
    ReportRS.Open "[MyTable] Order By FeildName1,FeildName2 ", db, adOpenStatic, adLockReadOnly
'
 Call ShowResult
End Sub
'
Private Sub Command3_Click()
'
 Set DataReport1.DataSource = ReportRS
 DataReport1.Show 1
End Sub
'
Private Sub Command4_Click()
'
 Call Form_Unload(0)
End Sub
'
Private Sub Form_KeyPress(KeyAscii As Integer)
'
 If KeyAscii = 27 Then
      KeyAscii = 0
       Call Form_Unload(0)
 End If
End Sub
'
Private Sub Form_Load()
'
 MDIMain.Skin2.ApplySkin Me.hWnd
'
 If db.State = adStateClosed Then Call OpenDataBase
 If ReportRS.State = adStateOpen Then ReportRS.Close
    ReportRS.Open "[ÇáÑæíÏ]", db, adOpenStatic, adLockReadOnly
'
 For i = 1 To ReportRS.Fields.Count - 4
  Combo1.AddItem ReportRS.Fields(i).Name
 Next i
'
 MSFlexGrid1.Cols = ReportRS.Fields.Count - 3
'
 For i = 0 To ReportRS.Fields.Count - 4
  MSFlexGrid1.ColWidth(i) = 2000
  MSFlexGrid1.ColAlignment(i) = 3
  MSFlexGrid1.TextMatrix(0, i) = ReportRS.Fields(i).Name
 Next i
'
 Call Command2_Click
'
      Combo1.Text = Combo1.List(0)
End Sub
'
Private Sub Form_Resize()
'
   Me.Left = MDIMain.ScaleWidth / 2 - Me.Width / 2
   Me.Top = MDIMain.ScaleHeight / 2 - Me.Height / 2
End Sub
'
Private Sub Form_Unload(cancel As Integer)
'
 Unload Me
'
       MDIMain.Frame2.Visible = False
  Call OffOnButton(False)
  Call RecordLenght
  Call ReadFields
       frmPhoneData.Show
End Sub
'
Private Sub Frame1_DragDrop(Source As Control, X As Single, Y As Single)
'
End Sub
'
Private Sub ShowResult()
'
 i = 0
 MSFlexGrid1.Rows = 1
'
                  If ReportRS.EOF = False Then
                     ReportRS.MoveFirst
        Do While Not ReportRS.EOF
i = i + 1
            MSFlexGrid1.Rows = i + 1
            For d = 0 To ReportRS.Fields.Count - 4
               If Not IsNull(ReportRS.Fields(d).Value) Then _
                      MSFlexGrid1.TextMatrix(i, d) = ReportRS.Fields(d).Value
            Next d
             ReportRS.MoveNext
            Loop
        End If
End Sub
'
Private Sub MSFlexGrid1_DblClick()
'
 If MSFlexGrid1.Row = 0 Then Exit Sub
 If MSFlexGrid1.Col = 0 Then Exit Sub
'
'
 Call ShowResult
End Sub
'
Private Sub Text1_GotFocus()
'
 Text1.SelStart = 0
 Text1.SelLength = Len(Text1.Text)
End Sub
'
Private Sub Text2_GotFocus()
'
 Text2.SelStart = 0
 Text2.SelLength = Len(Text2.Text)
End Sub

تحياتي

1

OMANI FOR EVER

-------------------------------------------------

post-12787-12780191801974.jpg

-------------------------------------------------

#5

تسلم يا باشا

وشكرا الك على المتابعة

مواضيع مشابهة