Linking a query to a form to generate the results on a report

  • I have a form with First Name, Last Name and Date fields all of which are combo boxes. There is a preview Button to preview the report I need to view.

    The aim of the form is to select these 3 fields from a combo box click preview to see all the appointments for that instructor on that particular day.

    This is the query I am using as the main query:

    SELECT Booking.Staff_Id, Booking.Student_Id, Student.First_Name, Student.Last_Name, Lesson_Type.Lesson_Desc, Lesson_Time.Lesson_Time, Lesson_DateSchedule.Lesson_Date

    FROM Student INNER JOIN (Lesson_Type INNER JOIN (Lesson_Time INNER JOIN (Lesson_DateSchedule INNER JOIN (Booking INNER JOIN Session_Information ON Booking.Booking_Id = Session_Information.Booking_Id) ON Lesson_DateSchedule.ScheduleDate_Id = Session_Information.ScheduleDate_Id) ON Lesson_Time.LessonTime_Id = Session_Information.Lesson_TimeId) ON Lesson_Type.Lesson_TypeId = Session_Information.Lesson_TypeId) ON Student.Student_Id = Booking.Student_Id

    WHERE Booking.Staff_Id=[Enter Staff Id] AND Lesson_DateSchedule.Lesson_Date=[Enter Date];

    How do I link all of this to get the result in a report?

  • cindy_sinath (11/11/2008)


    I have a form with First Name, Last Name and Date fields all of which are combo boxes. There is a preview Button to preview the report I need to view.

    The aim of the form is to select these 3 fields from a combo box click preview to see all the appointments for that instructor on that particular day.

    This is the query I am using as the main query:

    SELECT Booking.Staff_Id, Booking.Student_Id, Student.First_Name, Student.Last_Name, Lesson_Type.Lesson_Desc, Lesson_Time.Lesson_Time, Lesson_DateSchedule.Lesson_Date

    FROM Student INNER JOIN (Lesson_Type INNER JOIN (Lesson_Time INNER JOIN (Lesson_DateSchedule INNER JOIN (Booking INNER JOIN Session_Information ON Booking.Booking_Id = Session_Information.Booking_Id) ON Lesson_DateSchedule.ScheduleDate_Id = Session_Information.ScheduleDate_Id) ON Lesson_Time.LessonTime_Id = Session_Information.Lesson_TimeId) ON Lesson_Type.Lesson_TypeId = Session_Information.Lesson_TypeId) ON Student.Student_Id = Booking.Student_Id

    WHERE Booking.Staff_Id=[Enter Staff Id] AND Lesson_DateSchedule.Lesson_Date=[Enter Date];

    How do I link all of this to get the result in a report?

    In your query, replace each of your parameters like [Enter Staff Id] with a reference to the control on your selection form. For example, instead of

    [Enter Staff Id]

    you might use

    [Forms]![MySelectionForm]![cboStaffID]

    In the query designer, you can right-click in the criteria row and select Build... to bring up the Expression Builder. Note that the form has to remain open when you run the report.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply