Full Version: Printing Splitform
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
razno
Is there any way to print splitform with headers or someting other than plain raw table?
jleach
Forms don't lend themselves well for printing... query the same data for a Report (and subreport) instead and you'll have far more control over it.

Cheers,
razno
I know. To bad, because user wanted only header over datasheet, but it will be better as report.

How to send filtered result from splitform to report?
jleach
The one of the arguments for DoCmd.OpenReport is a Where condition that you can use to filter the results. I usually use a vba procedure (button click) to build a where clause based on whatever control values I need... the subreport for the detail data will be filtered similarly to how a subform filters data, so in most cases we just need to restrict the main record when opening.

Another method is to "query by form." In the query that is the recordsource for the report, have it refer to values on the form that can used to filter. Of course, this requires that the form itself is open whenever you try to run the report... I generally avoid this myself but it's a common technique. Ex: SELECT * FROM ThisTable WHERE SomeField = [Forms]![MyForm]![MyControl]

hth
razno
Thank you. I will try to put it together... I beleive second one will be best for user.

notworthy.gif
razno
Second option works where there is a same id. Let say id of class.
But if i select multiple ID it only show one.
Am i doing something wrong?
jleach
What is the query you're using to select the records?
razno


this is on form.

CODE
SELECT junUgoIspit.IDUgoIspit, Polaznici.Ime, Polaznici.Prezime, Polaznici.MB, Polaznici.OIB, Polaznici.ImeMajkeG, Polaznici.ImeOcaG, Polaznici.DatumRođenja, Polaznici.Država, Polaznici.MjestoRođenja, Polaznici.Državljanstvo, Polaznici.Spol, PrgModuli.ImeModula, PrgProgramiObrazovanja.Program, Rješenja.Klasa, Rješenja.Urbroj, Rješenja.Datum, junUgoIspit.IDIspita, Ispiti.DatumIspita, PrgStupnjevi.IDPrograma, PrgStupnjevi.Stupanj, Profesori.Ime, Profesori.Prezime, Profesori.Spol, Ugovori.ŠkGod, PrgProgramiObrazovanja.ImeSvjedodžba, AddSpaces([polaznici.Ime]) AS ImeRazmak, AddSpaces([polaznici.Prezime]) AS PrezimeRazmak, AddSpaces22([polaznici.OIB]) AS OIBRazmak, junUgoIspit.Razumljevanje, junUgoIspit.GramatičkeStrukture, junUgoIspit.JezičneStrukture, junUgoIspit.Pisanje, junUgoIspit.GovornaProdukcija, [Razumljevanje]+[GramatičkeStrukture]+[JezičneStrukture]+[Pisanje]+[Govornaprodukcija] AS Ukupno, Switch([razumljevanje]<10,"nedovoljan (1)",[GramatičkeStrukture]<10,"nedovoljan (1)",[Jezičnestrukture]<10,"nedovoljan (1)",[Pisanje]<10,"nedovoljan (1)",[GovornaProdukcija]<10,"nedovoljan (1)") AS Switch, IIf([Switch]="nedovoljan (1)","nedovoljan (1)",IIf([Ukupno]>=[G5],"odličan (5)",IIf([Ukupno]>=[G4],"vrlo dobar (4)",IIf([Ukupno]>=[G3],"dobar (3)",IIf([Ukupno]>=[G2],"dovoljan (2)","nedovoljan (1)"))))) AS Ocjena, tblispitidodatno.G2, tblispitidodatno.G3, tblispitidodatno.G4, tblispitidodatno.G5, tblispitidodatno.Klasa1, tblispitidodatno.Klasa2, tblispitidodatno.URBroj, Ispiti.IDŠkGod, Skupine.IDProfesora, tblŠkolskegodine.ŠkGodTxt, tblŠkolskegodine.Semester, tblŠkolskegodine.Semestertxt, tblŠkolskegodine.ŠkGod, Ugovori.KlasaSeq
FROM tblispitidodatno RIGHT JOIN (tblŠkolskegodine RIGHT JOIN (Profesori RIGHT JOIN (Skupine RIGHT JOIN ((PrgProgramiObrazovanja RIGHT JOIN (Rješenja RIGHT JOIN (PrgStupnjevi RIGHT JOIN PrgModuli ON PrgStupnjevi.IDStupnja=PrgModuli.IDStupnja) ON Rješenja.IDRješenja=PrgStupnjevi.Rješenje) ON PrgProgramiObrazovanja.IDPrograma=PrgStupnjevi.IDPrograma) RIGHT JOIN (Ispiti RIGHT JOIN ((Polaznici RIGHT JOIN Ugovori ON Polaznici.IDPolaznika=Ugovori.IDPolaznika) RIGHT JOIN junUgoIspit ON Ugovori.IDUgovora=junUgoIspit.IDUgovora) ON Ispiti.IDIspita=junUgoIspit.IDIspita) ON PrgModuli.IDModula=Ugovori.IDModula) ON Skupine.IDSkupine=Ugovori.IDSkupine) ON Profesori.IDProfesora=Skupine.IDProfesora) ON tblŠkolskegodine.IDŠkGod=Ispiti.IDŠkGod) ON tblispitidodatno.IDŠkGod=tblŠkolskegodine.IDŠkGod
WHERE (((PrgStupnjevi.IDPrograma)<>9));



and this in report:


CODE
SELECT qrySvjedodzba.IDUgoIspit, qrySvjedodzba.Polaznici.Ime, qrySvjedodzba.Polaznici.Prezime, qrySvjedodzba.MB, qrySvjedodzba.OIB, qrySvjedodzba.ImeMajkeG, qrySvjedodzba.ImeOcaG, qrySvjedodzba.DatumRođenja, qrySvjedodzba.Država, qrySvjedodzba.MjestoRođenja, qrySvjedodzba.Državljanstvo, qrySvjedodzba.Polaznici.Spol, qrySvjedodzba.ImeModula, qrySvjedodzba.Program, qrySvjedodzba.Klasa, qrySvjedodzba.Rješenja.URBroj, qrySvjedodzba.Datum, qrySvjedodzba.IDIspita, qrySvjedodzba.DatumIspita, qrySvjedodzba.IDPrograma, qrySvjedodzba.Stupanj, qrySvjedodzba.Profesori.Ime, qrySvjedodzba.Profesori.Prezime, qrySvjedodzba.Profesori.Spol, qrySvjedodzba.Ugovori.ŠkGod, qrySvjedodzba.ImeSvjedodžba, qrySvjedodzba.ImeRazmak, qrySvjedodzba.PrezimeRazmak, qrySvjedodzba.OIBRazmak, qrySvjedodzba.Razumljevanje, qrySvjedodzba.GramatičkeStrukture, qrySvjedodzba.JezičneStrukture, qrySvjedodzba.Pisanje, qrySvjedodzba.GovornaProdukcija, qrySvjedodzba.Ukupno, qrySvjedodzba.Switch, qrySvjedodzba.Ocjena, qrySvjedodzba.G2, qrySvjedodzba.G3, qrySvjedodzba.G4, qrySvjedodzba.G5, qrySvjedodzba.Klasa1, qrySvjedodzba.Klasa2, qrySvjedodzba.tblispitidodatno.URBroj, qrySvjedodzba.IDŠkGod, qrySvjedodzba.IDProfesora, qrySvjedodzba.ŠkGodTxt, qrySvjedodzba.Semester, qrySvjedodzba.Semestertxt, qrySvjedodzba.tblŠkolskegodine.ŠkGod, qrySvjedodzba.KlasaSeq
FROM qrySvjedodzba
WHERE (((qrySvjedodzba.IDUgoIspit)=[Forms]![frmPopisSvjedodžbi]![IDUgoIspit]));



Dont know is this is what are you asking me....
jleach
Yea, that's what I was looking for. Let's take a look at the one for the report... in particular the where clause:

SQL
WHERE (((qrySvjedodzba.IDUgoIspit)=[Forms]![frmPopisSvjedodžbi]![IDUgoIspit]));


This is what's restricting your records, and the way it's set right now you are selecting only one record, specifically where the query field is equal to the form field.

Returning multiple records with a where clause usually looks something like this:

SQL
WHERE ThisField Between X and Y
WHERE ThisField In(X, Y, Z)
WHERE ThisField > X


To select a range of records based on some form criteria, you might use something like this:

SQL
WHERE ThisField Between [Forms]![MyForm]![StartValueControl] And [Forms]![MyForm]![EndValueControl]


To return more than one record from the report, you'll have to adjust your form controls and query criteria accordingly (you might end up with two separate queries, one for a single record and one for a range... this is one reason (of many) that I prefer using the VBA where building technique, as you can have the report recordset on a base query and apply the where clause as it's opened).

Does that help at all? Sorry, it's a little difficult to guess at what the scenario might be being that I don't understand the language (was hoping to get some insight through the queries involved but no luck!)

Cheers,
razno
In that (split) form i have id of contract and i need user to filter it by professor or by program they study.
So id's are random if its by id.

Can you tell me code to change report querry?

razno
Problem is when user filter based on language i get IDUgoIspit not in range but eg. 49,56,109,145....
Ok, i can set up based on language, but maybe then user decide he will filter based on date of exam..

Is there way to send only displayed id-s to report?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.