Results 1 to 12 of 12

Thread: code to open TeacherDetailFrm form Mainform By double click on the FirstNameTxt..

  1. #1
    Join Date
    Apr 2007
    Posts
    38

    code to open TeacherDetailFrm form Mainform By double click on the FirstNameTxt..

    Hi
    I need code to open TeacherDetailFrm form Mainform.

    I have TeacherStudentSubFr*m on the Mainform, FirstNameTxt on the
    TeacherStudentSubFr*m, and TeacherDetailFrm.
    I need code to open the TeacherDetailFrm By double click on the FirstNameTxt.

    I use this code but no data come and query dialog box come.

    Private Sub FirstNameTxt_DblCli*ck(Cancel As Integer)
    Dim DocSubForm As String
    Dim DocText As String
    DocSubForm = "TeacherDetailFrm"
    DoCmd.OpenForm DocSubForm, , , "[ FirstNameFld ]=forms![TeacherStudentSubFrm]!
    [ FirstNameTxt]"

    End Sub
    Attached Files Attached Files

  2. #2
    Join Date
    Oct 2006
    Location
    Maitland NSW Australia
    Posts
    275

    Smile Main Form by double click

    Try this code
    DoCmd.OpenForm DocSubForm, acNormal, "", "[FirstNameFld]=[Forms]![mainfrm]![TeacherStudentSubFrm]![ FirstNameTxt]", , acNormal

    You must reference the main form [mainfrm] when using a subform to do an action etc.
    Allan

  3. #3
    Join Date
    Apr 2007
    Posts
    38
    Hi Allan Murphy

    thank you so much for your help,

    I use the code you wrote to me and I try from TeacherStudentSubFrm, the date come ok, but from MainFrn can not come data

    Sami

  4. #4
    Join Date
    Oct 2006
    Location
    Maitland NSW Australia
    Posts
    275

    Talking Teacher Detail Form

    Sami

    You may have put the code on the wrong form.

    I have attached an updated version of your database with code in the correct location , I have also put the name of the forms on the screen.

    Open Mainfrm, the TeacherStudentsubform is displayed on the screen.

    Double Click on the FirstName in this case SAM1 and the TeacherDetailForm opens.
    Attached Files Attached Files
    Allan

  5. #5
    Join Date
    Apr 2007
    Posts
    38
    Hi Allan Murphy

    I try to open your correction on (OpenDetailForm_v2.ldb)
    I try open the (TeacherDetailFrm) By double click on the (FirstNameTxt).


    the problems,
    1-when I open the (TeacherDetailFrm) form MainFrm, the data dose not appear in (TeacherDetailFrm).

    2-When I open (TeacherDetailFrm) from (TeacherStudentSubFrm) a dialog box appears and data come ok.

    I need to solve problem Number -1.

  6. #6
    Join Date
    Oct 2006
    Location
    Maitland NSW Australia
    Posts
    275

    Teacher Database

    Sami

    Can we rewind back to the beginning. What is the purpose of this database? It appears that you are trying to establish a class list for each teacher, by listing all the students that are in the teacher's class.
    Allan

  7. #7
    Join Date
    Apr 2007
    Posts
    38
    Hi Allan Murphy

    No need class list,
    Just I need data appears in (TeacherDetailFrm) by open through MainFrm.


    thanks

  8. #8
    Join Date
    Oct 2006
    Location
    Maitland NSW Australia
    Posts
    275

    Detail Form

    Is this correct?
    1. The Teacher Student subform is a list of students.
    3. The Teacher Detail form is used by the teacher to display
    the full details of a student when the teacher clicks on the student's first name using the main form.
    Allan

  9. #9
    Join Date
    Oct 2006
    Location
    Maitland NSW Australia
    Posts
    275

    Talking Teacher Detail

    Sami
    Have a look at the latest version. I used only 1 table tbl_student. Open the main_form and click on a student's first name and the full details for the selected student will be displayed.
    Attached Files Attached Files
    Allan

  10. #10
    Join Date
    Apr 2007
    Posts
    38
    Hi Allan Murphy

    Is this correct?
    1. The Teacher Student subform is a list of students.
    3. The Teacher Detail form is used by the teacher to display
    the full details of a student when the teacher clicks on the student's first name using the main form.
    1. The Teacher Student subform is a list of teacher and student.
    3. The Teacher Detail form is used by user to display the full details of a teacher when he clicks on the first name using the main form.


    Exactly I like as your correction (OpenDetailForm_v2.ldb) and display the full details of a teacher when the user clicks on the first name using the main form.

    I need to solve this problem by anyway, by one table or two tables .... one query or two queries or......

    Thanks

  11. #11
    Join Date
    Oct 2006
    Location
    Maitland NSW Australia
    Posts
    275

    Question Teacher Student Details

    I am confused with your previous replies.
    1. I need code to open the TeacherDetailFrm By double click on the FirstNameTxt.
    2. The Teacher Detail form is used by user to display the full details of a teacher when he clicks on the first name using the main form.
    It appears that you want to do two different things when you click on the student's first name.

    1. You want to display the teacher details when you select a student.
    2. You want to display the teacher's detail when you select a teacher.

    Have a look at the attached database. Does this meet your requirements?
    Attached Files Attached Files
    Allan

  12. #12
    Join Date
    Apr 2007
    Posts
    38
    Hi Allan Murphy
    Thank you so much and I appreciate your efforts to solve my problem.

    I got it the the error and solve it:
    this errer in the code there is space [ FirstNameTxt]
    this correction in the code [FirstNameTxt]
    Last edited by SAMI2; 06-19-2007 at 10:23 AM.

Posting Permissions

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