اذهب الي المحتوي
أوفيسنا

مشكله في دالة Concentrate items


hosslom

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

السلام عليكم اخوتي

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

عند عمل استعلام يحدث تكرار لاسم الاختبار ولا ينظر لمعيار الكود للمريض

هل من حل في الكود ؟

وشكرا جزيلا

test.rar

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

استبدل الفانك لديك بهذا .....

Public Function Concatenate_test_items(C As String) As String

    Dim rst As DAO.Recordset
    Dim myWhere As String
    
    'do the Where Criteria in an easy way, item by item
     myWhere = myWhere & "[tube]='" & C & "' AND [code]='" & 1000 & "'"
    
    'set the Data source
    Set rst = CurrentDb.OpenRecordset("Select [test] From [Table1] Where " & myWhere)
    
    'Loop through the Records
    Do Until rst.EOF
    
        'Concatenate the items
        Concatenate_test_items = Concatenate_test_items & ", " & rst!test
        
        'move to the next Record
        rst.MoveNext
    
    Loop
    
    'Remove the initial ", ", thats why we start from the 3rd letter
    Concatenate_test_items = Mid(Concatenate_test_items, 3)
    
    'clean up memory
    rst.Close: Set rst = Nothing
    
End Function

 

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

15 دقائق مضت, Barna said:
Public Function Concatenate_test_items(C As String) As String

    Dim rst As DAO.Recordset
    Dim myWhere As String
    
    'do the Where Criteria in an easy way, item by item
     myWhere = myWhere & "[tube]='" & C & "' AND [code]='" & 1000 & "'"
    
    'set the Data source
    Set rst = CurrentDb.OpenRecordset("Select [test] From [Table1] Where " & myWhere)
    
    'Loop through the Records
    Do Until rst.EOF
    
        'Concatenate the items
        Concatenate_test_items = Concatenate_test_items & ", " & rst!test
        
        'move to the next Record
        rst.MoveNext
    
    Loop
    
    'Remove the initial ", ", thats why we start from the 3rd letter
    Concatenate_test_items = Mid(Concatenate_test_items, 3)
    
    'clean up memory
    rst.Close: Set rst = Nothing
    
End Function

شكرا لمرورك الكريم

للاسف الكود لايعطي المطلوب ؟؟

هل يمكن ارفاق المثال بالكود لو تكرمت

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

1 دقيقه مضت, Barna said:

شكرا لمرورك الكريم

للاسف الكود لايعطي المطلوب ؟؟

هل يمكن ارفاق المثال بالكود لو تكرمت

نعم هذا هو المطلوب ولكن لايعطيني النتيجة المطلوبه لا ادري لماذا

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

12 ساعات مضت, hosslom said:

اليس هذا هو نتيجة برنامجك قبل التعديل ؟؟؟؟؟؟؟

اخي الكريم اسف علي الازعاج 

ولكن عند تضمين المثال في القاعده عندي لتطبيقها يعطيني خطأ عند معاينه التقرير 😪😪

أرفقت القاعده جزاك الله كل خير

Capture2.JPG

test2.accdb

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

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