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

مطلوب كود يعطي عنوان الحقل


ledoledo
إذهب إلى أفضل إجابة Solved by jjafferr,

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

السلام عليكم 

كل عام و انتم بخير

اطلب من الاخوة كود يعطي عنوان الحقل كامل

مثال  . اسم النموذج form1 و اسم الحقل text1

يجب عند الضغط على زر امر مثلا ظهور رسالة بها العنوان كالتالى 

forms!form1!text1

مشكورين

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

وعليكم السلام:smile:

 

اعمل زر في النموذج ، وضع عليه هذا الكود ، وسيعطيك جميع اسماء الكائنات في النموذج:

    Dim ctl As Control
    
    For Each ctl In Me.Controls

        'If ctl.ControlType = acTextBox Then
            MsgBox "Forms!" & Me.Name & "!" & ctl.Name
        'End If

    Next

 

اما اذا اردت معرفة كائنات نموذج آخر ، فضع الكود التالي في وحدة نمطية:

Function Control_Names(frm As Form)

    Dim ctl As Control
    
    For Each ctl In frm.Controls
   
        'If ctl.ControlType = acTextBox Then
            MsgBox "Forms!" & frm.Name & "!" & ctl.Name
        'End If
        
    Next
    
End Function


ثم تناديها من اي نموذج ، وترفق اسم النموذج الذي تريد معرفة كائناته

	call Control_Names("frm_Main")

 

واذا اردت معرفة كائنات جميع النماذج في قاعدة البيانات ، فضع الكود التالي في وحدة نمطية:

Function DB_Form_Control_Names2()

    Dim AccObjects As Object
    Dim frm As Form
    Dim ctl As Control
    
    For Each AccObjects In CurrentProject.AllForms
        Set frm = Forms(AccObjects.Name)
        
        For Each ctl In frm
            'If ctl.ControlType = acTextBox Then
                MsgBox "Forms!" & frm.Name & "!" & ctl.Name
            'End If
        Next

    Next
    
End Function


وتناديها من اي نموذج هكذا:

	call DB_Form_Control_Names2

 

جعفر

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

  • أفضل إجابة

تفضل:smile:

 


Function Control_Names(frm As Form)

    Dim ctl As Control
    Dim ctl2 As Control
    
    For Each ctl In frm.Controls
        
        If ctl.ControlType = acSubform Then
            
            'subform
            For Each ctl2 In frm(ctl.Name).Form
                Debug.Print "Forms!" & frm.Name & "!" & ctl.Name & "!" & ctl2.Name
            Next
    
        Else
            'normal Form objects
            Debug.Print "Forms!" & frm.Name & "!" & ctl.Name

        End If
        
    Next ctl
    
End Function


وتناديها
call Control_Names(me)

 

جعفر

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

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