Date: prev next · Thread: first prev next last
2015 Archives by date, by thread · List index

On 06/27/15 09:17, Ed Beroset wrote:
Gabriele Ponzo wrote:
The list doesn't allow attachments. Could you keep them on a xloud and

The file I tried to attach is available here:

What i see is that you should prepare a query where you already have 14
results (even null) in a single record.

Yes, I think that would work but I don't know how to do that.


Hey Ed,

Mail Merge requires each single line to contain all the data for that
particular document.  You can not combine data from several lines onto
one mail merge document.

If you want to have 14 records per student you can either do that
manually in each table, or write some BASIC code to manage it all.  You
could do it if you create a new table with a course number column
numbered 1 - 14 for each student, then fill in each record with each
students course as they register.

Warning Will Robinson!  That can get very messy in a really big hurry.
Like, what will you do if your assumption that 14 classes is the maximum
that any student will take turns out to be incorrect?  What do you do
when hundreds of students only sign up for one or two classes?  Then you
have literally thousands of blank records taking up space and slowing
processing in your database.

What you really need is a report that will group records by student and
combine them all onto one or more report sheet(s).  You can do that by
creating a separate record set, by student, and printing a report for
that student.

I'm not up to speed on LO BASIC but in VBA your code would look
something like this:

create recordset rsStudent = "SELECT Students.StudentID FROM Students;"
with rsStudent
        until rsStudent = EOF
                intStudentID = !StudentID
                create recordset rsClassReport = "SELECT "Schedules"."StudentID"
"StudentID", "Students"."LastName" "LastName", "Students"."FirstName"
"FirstName", "Schedules"."ClassID" "ClassID", "Classes"."ClassTitle"
"ClassTitle", "Classes"."CreditHours" "CreditHours" FROM "Schedules"
"Schedules", "Students" "Students", "Classes" "Classes" WHERE
"Schedules"."StudentID" = & intStudentID &  AND "Schedules"."ClassID" =
"Classes"."ClassID" ORDER BY "StudentID", "ClassID"
                with rsClassReport
                        if not EOF
                                Call your report here.  Hand the query results to the report.
                        end if
                end with
end with

I left out a lot of details here but that's the general flow of the code
your need.

You need a dynamic query, rsClassReport, that will only pull the records
that pertain to the one student, intStudentID, that you are reporting on.

You will also need to add other columns for current/past student, passed
or failed course, course instructor, class room, class time, etc... to
make this database useful beyond a single semester.

   ^ ^  Mark LaPierre
Registered Linux user No #267004

To unsubscribe e-mail to:
Posting guidelines + more:
List archive:
All messages sent to this list will be publicly archived and cannot be deleted


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.