Results 1 to 6 of 6
  1. #1
    Join Date
    Oct 2013
    Posts
    35

    Unanswered: how to open SubForm With Button

    dear all
    Has two tables employee table and table Courses and you link between the two tables in a manner
    Required
    How can open (SubForm , Courses) by (Button) and be linked to the main for
    Attached Files Attached Files

  2. #2
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    495
    Provided Answers: 24
    Docmd.openform "frmMainAndSub"

    the subform is in the main form.

  3. #3
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    1. There is no form with a subform in the database you posted in attachment.

    2. Having a reference to another form in the Filter property of a form as the Filter property of the form Courses is not the best solution. Remove this from the Filter property of the form Courses:
    Code:
    [cid]=forms![Courses].form![id]

    3. Normally, you open a related form by using the WhereCondition parameter of the Openform method used to open the second form. In your case, use this code in the module of the form Employees:
    Code:
    Private Sub cmdCourses_Click()
    
        DoCmd.OpenForm "Courses", , , "cid=" & Me.ID
        
    End Sub
    Have a nice day!

  4. #4
    Join Date
    Oct 2013
    Posts
    35
    Very Thank You My Dear Teacher
    but my dear teacher Sinndho In the field (FK) in courses Form I have to do it manually by typing the number
    Can you write the number immediately with no record of what I typed manually

  5. #5
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Sorry, I don't understand your question. Can you elaborate?
    Have a nice day!

  6. #6
    Join Date
    Oct 2013
    Posts
    35
    thank you all teacher

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •