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

فتح أكثر من قاعدة بيانات من نموذج واحد فقط ..


عفرنس
إذهب إلى أفضل إجابة Solved by ابو البشر,

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

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

 

نعم يمكن ، وتفتح نموذج معين ، وتعمل له تصفية ، وللقراءة فقط 🙂 

يعني تعمل فيه اللي تريد 🙂

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

Private Sub cmd_View_Kids_info_Click()
On Error GoTo err_cmd_View_Kids_info_Click

    Dim appAccess As Object
    Dim DB_Path As String
    Dim myWhere As String
    
    'if the Remote Application/Form is open, close it first
    appAccess.DoCmd.Quit
    
    'now open the Form for the new Employee_ID
    Set appAccess = CreateObject("Access.Application")
    DB_Path = "\\Managing_1\h\Personal\FE\Personal_FE.accdb"
    appAccess.OpenCurrentDatabase (DB_Path)
    myWhere = "[Full_Name]='" & Me.frm_1_All!Full_Name & "'"
    myWhere = myWhere & " And [Relation]<>'زوجة'"
    myWhere = myWhere & " And [Relation]<>'زوج'"
    appAccess.DoCmd.OpenForm "sfrm_Family", , , myWhere, acFormReadOnly
    appAccess.Visible = True
    appAccess.UserControl = True
    'Set appAccess = Nothing

Exit_cmd_View_Kids_info_Click:

    Exit Sub
err_cmd_View_Kids_info_Click:

    If Err.Number = 91 Or Err.Number = 462 Then
        'the application is NOT open, ignore the error
        Resume Next
    Else
        MsgBox Err.Number & vbCrLf & Err.Description
    End If
    
End Sub

 

جعفر

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

12 دقائق مضت, jjafferr said:

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

 

نعم يمكن ، وتفتح نموذج معين ، وتعمل له تصفية ، وللقراءة فقط 🙂 

يعني تعمل فيه اللي تريد 🙂

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


Private Sub cmd_View_Kids_info_Click()
On Error GoTo err_cmd_View_Kids_info_Click

    Dim appAccess As Object
    Dim DB_Path As String
    Dim myWhere As String
    
    'if the Remote Application/Form is open, close it first
    appAccess.DoCmd.Quit
    
    'now open the Form for the new Employee_ID
    Set appAccess = CreateObject("Access.Application")
    DB_Path = "\\Managing_1\h\Personal\FE\Personal_FE.accdb"
    appAccess.OpenCurrentDatabase (DB_Path)
    myWhere = "[Full_Name]='" & Me.frm_1_All!Full_Name & "'"
    myWhere = myWhere & " And [Relation]<>'زوجة'"
    myWhere = myWhere & " And [Relation]<>'زوج'"
    appAccess.DoCmd.OpenForm "sfrm_Family", , , myWhere, acFormReadOnly
    appAccess.Visible = True
    appAccess.UserControl = True
    'Set appAccess = Nothing

Exit_cmd_View_Kids_info_Click:

    Exit Sub
err_cmd_View_Kids_info_Click:

    If Err.Number = 91 Or Err.Number = 462 Then
        'the application is NOT open, ignore the error
        Resume Next
    Else
        MsgBox Err.Number & vbCrLf & Err.Description
    End If
    
End Sub

 

جعفر

أستاذي الفاضل .. 

هل بالإمكان تطبيق الكود على هذا المرفق .. ولك جزيل الثواب .. 

fayz.rar

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

7 دقائق مضت, ابو البشر said:

وليش ما يكونوا داخل برنامج واحد !!!!

لدي أكثر من برنامج .. وليس لي معرفة في البرمجة .. 

هي فكرة طرأت في خاطري وهي : أعمل نموذج ، يحتوي على عدة نوافذ ، كل نافذة بكبسة زر تفتح لي البرنامج المخصص لها .. 

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

  • أفضل إجابة
55 دقائق مضت, emam1424 said:

لدي أكثر من برنامج .. وليس لي معرفة في البرمجة .. 

هي فكرة طرأت في خاطري وهي : أعمل نموذج ، يحتوي على عدة نوافذ ، كل نافذة بكبسة زر تفتح لي البرنامج المخصص لها .. 

ربما هذا هو المطلوب

fayz.rar

تم تعديل بواسطه ابو البشر
  • Like 4
رابط هذا التعليق
شارك

7 ساعات مضت, ابو البشر said:

ربما هذا هو المطلوب

fayz.rar 174.26 kB · 5 تنزيلات

شكر الله لك أبا البشر .. هذا هو المطلوب تماما .. 

والشكر أيضا للأستاذين ( جعفر - أحمد ) 

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

اسمحوا لي ان اشرح فائدة الطريقة اللي اشرت لها انا 🙂

 

الفائدة هي محاكاة البرنامج الاخر ، وارسال بيانات له ، واستيراد بيانات منه ،

وهذا لا يقتصر على قاعدة البيانات التي فتحت البرنامج الآخر ، وانما يعتمد على اي عدد من قواعد البيانات التي فتحتها عن طريق المتغير appAccess و appAccess2 و ...

وبعد اذن اخي ابو البشر ، فاستخدمت مرفقه ، وبتعديل بسيط على البرنامج Sub بحيث النموذج mark2 لا يُفتح تلقائيا ، واضفت له زر :

image.png.6b7c5e9cb2e56e080271308cc0fad5b8.png

 

الكود التالي :

يفتح قاعدة البيانات Sub ،

1. يرسل القيمة "c:\abc\abc" الى الحقل  txtPath ،

2. ويأخذ المسمى الموجود في حقل التسمية 7 ، ويضعه في برنامجنا :

image.png.7f6427b0b21989d0b0bf040455d75c96.png

Private Sub cmd_View_Kids_info_Click()
On Error GoTo err_cmd_View_Kids_info_Click

    Dim appAccess As Object
    Dim DB_Path As String
    Dim myWhere As String
    
    'if the Remote Application/Form is open, close it first
    appAccess.DoCmd.Quit
    
    'now open the Form for the new Employee_ID
    Set appAccess = CreateObject("Access.Application")
    DB_Path = Application.CurrentProject.Path & "\mark2.mdb"
    appAccess.OpenCurrentDatabase (DB_Path)
    
    appAccess.DoCmd.OpenForm "Mark"
    appAccess.Visible = True
    
    With appAccess.Forms!Mark
        .txtPath = "c:\abc\abc"
        Me.lbl2.Caption = .[تسمية7].Caption
    End With
    
    appAccess.UserControl = True
    'Set appAccess = Nothing

Exit_cmd_View_Kids_info_Click:

    Exit Sub
err_cmd_View_Kids_info_Click:

    If Err.Number = 91 Or Err.Number = 462 Then
        'the application is NOT open, ignore the error
        Resume Next
    Else
        MsgBox Err.Number & vbCrLf & Err.Description
    End If
    
End Sub

 

جعفر

fayz.zip

  • 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