اذهب الي المحتوي
أوفيسنا
بحث مخصص من جوجل فى أوفيسنا
Custom Search

مشكلة عند عمل تقرير من استعلام جدولى


monm

الردود الموصى بها

العفو ، بس كنت مشغول حبتين 🙂

 

بسبب تنسيق التاريخ في كمبيوترك، عندك هذا الخلل ،

جرب المرفق لوسمحت ، فانا استعنت بكود التاريخ من هنا :

 

.

والكود اصبح:

Private Sub Report_Open(Cancel As Integer)

    Dim ctrl As Control
    Dim A As Integer
    Dim Empty_Cells As Integer
    Dim Full_Cells As Integer
    Dim W As Integer
    Dim myWhere As String
    Dim rpt_width As Integer
    Dim Full_Date As Date
    Dim D As Integer
    Dim Y As Integer
    Dim M As Integer
   
    W = 1440 / 2    'field width
    Empty_Cells = 0
    Full_Cells = 1  'the name
    rpt_width = 0
        
    Y = Forms!tqrer!iYear   'year
    M = Forms!tqrer!iMonth  'month
    

    
    For Each ctrl In Me.Controls
        
        'is this a Date field in the Report
        If ctrl.ControlType = acTextBox And IsNumeric(Mid(ctrl.Name, 5)) Then
            
            D = Mid(ctrl.Name, 5)
            Full_Date = DateSerial(Y, M, D)     'the field Names from the Crosstab query
            
            'check if this field exists int the table
            'myWhere = "[zeiara_date]=#" & Full_Date & "#"
            myWhere = "[zeiara_date]=" & DateFormat(Full_Date)
            'myWhere = myWhere & Chr(32) & " And [zeiara_date] Between Date_1 and Date_2"
            A = DCount("*", "zeara", myWhere)
            
        End If
        
        
        
        If A = 0 And ctrl.ControlType = acTextBox And Left(ctrl.Name, 4) = "txt_" Then
            'field dose not exist
            
            Me("txt_" & D).Width = 0                        'trim field size to Zero
            Me("txt_" & D).Visible = False                  'make the field invisible
            ctrl.ControlSource = ""                         'remove the Control Source
                
            Me("lbl_" & D).Width = 0                        'trim label size to Zero
            Me("lbl_" & D).Visible = False                  'make the label invisible
                
            Empty_Cells = Empty_Cells + 1
                
Debug.Print "Off " & ctrl.Name & vbTab & "D:" & D & vbTab & "Full:" & Full_Date & vbTab & "A:" & A
        ElseIf ctrl.ControlType = acTextBox And Left(ctrl.Name, 4) = "txt_" Then
            'field exists

            Me("txt_" & D).Width = 1 * W                    'set the field width
            Me("txt_" & D).Visible = True                   'make the field visible
            ctrl.ControlSource = Full_Date
                
            Me("lbl_" & D).Width = 1 * W                    'set the label width
            Me("lbl_" & D).Visible = True                   'make the label visible
            Me("lbl_" & D).Caption = D & "/" & M            'give the label, a caption
            
            Full_Cells = Full_Cells + 1
            rpt_width = rpt_width + ctrl.Width              'add the width
Debug.Print "ON  " & ctrl.Name & vbTab & "D:" & D & vbTab & "Full:" & Full_Date & vbTab & "A:" & A
        End If
        
    Next
 

    Me.Width = rpt_width + Me("mogh_name").Width            'the final Report width
    
End Sub

.

جعفر

1001.rpt_Monthly_Crosstab.accdb.zip

رابط هذا التعليق
شارك

الحمدلله 🙂

بالنسبة الى العرض ، مثل ما اخبرتك، حاليا ما عندك خيار إلا ان تكون جميع اعمدة التواريخ بنفس العرض ،

والعرض يتم التحكم فيه من الكود ، من المتغير W (كما في الصورة ادناه) ،

كان العرض نصف بوصة ، والان عملته بوصه

1001.4.Clipboard04.jpg.230ea3c94664222464abd3826de20319.jpg

.

والتقرير ، يجب ان نجعل الحقول قابلة للنمو/للإرتفاع (ليست قابلة لإحتواء البيانات)،

يجب تغيير اعدادات القسم، بحيث يقبل النمو

1001.4.Clipboard01.jpg.51f0f7347b1e83713a4fb072813b3824.jpg

.

و نختار جميع الحقول ، وكذلك نجعلها قابله للنمو

1001.4.Clipboard02.jpg.e193013211c2304eef1a95e78d96fbef.jpg

.

والنتيجة

1001.4.Clipboard03.jpg.ce6e79e7127dfeb742489c74704085db.jpg

.

طبعا تستطيع تغيير مكان الحقول، بسحبها الى المكان الصحيح، وتغيير تنسيق اتجاه الخط من اليمين الى اليسار.

 

ولكن انتبه ، يجب ان يكون حجم الورقة عندك كبير ، حتى لا تطبع اجزاء من الصفحة على الصفحة التالية 😞

 

جعفر

رابط هذا التعليق
شارك

استاذى الكبير الغالى

هذا مجهود رائع وصبرا جميلا ومساعدة قيمة 

لا أجد كلمات للتعبير عن مدى شكرى الكبير لشخصكم الكريم 

وسؤال : هل يمكن أن نصل لهذه الاحترافية ؟ وما هى الطريقة المثلى لذلك؟

وفقكم الله الى كل ما تصبوا اليه

رابط هذا التعليق
شارك

وعليكم السلام 🙂

 

حياك الله 🙂

 

1 ساعه مضت, monm said:

هل يمكن أن نصل لهذه الاحترافية ؟ وما هى الطريقة المثلى لذلك؟

نعم ، وزيادة ، والطريقة هي السعي لقضاء حاجة اخوانك ، وخصوصا اللي في المنتدى 🙂

 

اما بالنسبة لي انا ، فكما يقول الله عز وجل:

وَمَا أُوتِيتُم مِّنَ الْعِلْمِ إِلَّا قَلِيلًا

 

جعفر

  • Thanks 1
رابط هذا التعليق
شارك

  • 2 weeks later...

كل الاحترام والتقدير استاذ جعفر علي علمك وتواضعك ومد يد المساعدة لنا ومساعدتنا فيما نحتاج الية بارك الله فيك وجزاك خير 

رابط هذا التعليق
شارك

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

زائر
اضف رد علي هذا الموضوع....

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • تصفح هذا الموضوع مؤخراً   0 اعضاء متواجدين الان

    • لايوجد اعضاء مسجلون يتصفحون هذه الصفحه
×
×
  • اضف...

Important Information