No sorry, I did not by mistake. The SQL I sent was the new one that works
without the selection. Of course I should have sent the faulty one. It was
not meant to spoil any time from you. Below I send the one that does not
work.
In my first mail I said "myform" and "mycontrol" as general names. Here they
are called "utskrifter" and "kundval"
You said that you expected someting after "PIVOT Lager.KategoriNr In
(......);" There is still nothing of that, and I don't know what and how to
put something there. This is generated by Access in the automated pane (QBE
or something alike?). Maybe you have found something here that could explain
why it doesn't work...?
Well, it works in the meaning that I now get the intended selection, when
running the crosstab query itself. But it doesn't work when I build a new
query from this result, that then should give the report. And it is
indicated, when I for instance try to create a report direct from the
crosstab query with help of the wizard.
PARAMETERS [forms]![utskrifter]![kundval] Long;
TRANSFORM Sum(Utleverans.Summa) AS SummaförSumma
SELECT Order.Fraktsedel AS Waybill, Mottagare.Namn AS Consignee,
Mottagare.Adress AS Address, Mottagare.Postnr AS Postal,
Mottagare.Postadress AS [Place of del], Order.KundNr, Sum(Utleverans.Summa)
AS [Sum]
FROM Mottagare INNER JOIN (((Kunder INNER JOIN Lager ON Kunder.KundNr =
Lager.KundNr) INNER JOIN [Order] ON Kunder.KundNr = Order.KundNr) INNER JOIN
Utleverans ON (Order.OrderNr = Utleverans.OrderNr) AND (Lager.ArtikelNr =
Utleverans.ArtikelNr)) ON Mottagare.MottagareNr = Order.MottagareNr
WHERE (((Order.KundNr)=[forms]![utskrifter]![kundval]))
GROUP BY Order.Fraktsedel, Mottagare.Namn, Mottagare.Adress,
Mottagare.Postnr, Mottagare.Postadress, Order.KundNr, Order.LevDatum
PIVOT Lager.KategoriNr;
/ Rolf
Duane Hookom said:
You did not "enter all possible column headings into the Column Headings
property". I would expect to see "PIVOT Lager.KategoriNr In (......);" at
the end of your sql syntax.
I don't see any reference to " [forms]![myform]![mycontrol]" in the SQL view
and also don't see any parameter data types in the sql which would start
with: "PARAMETERS [forms]![myform]![mycontrol] Date/Time;"
--
Duane Hookom
MS Access MVP
Rolf Rosenquist said:
Yes, the column and row headings are specified
And the form is open and populated.
The SQL view is
TRANSFORM Sum(Utleverans.Summa) AS SummaförSumma
SELECT Order.Fraktsedel AS Waybill, Mottagare.Namn AS Consignee,
Mottagare.Adress AS Address, Mottagare.Postnr AS Postal,
Mottagare.Postadress AS [Place of del], Order.KundNr,
Sum(Utleverans.Summa)
AS [Sum]
FROM Mottagare INNER JOIN (((Kunder INNER JOIN Lager ON Kunder.KundNr =
Lager.KundNr) INNER JOIN [Order] ON Kunder.KundNr = Order.KundNr) INNER
JOIN
Utleverans ON (Order.OrderNr = Utleverans.OrderNr) AND (Lager.ArtikelNr =
Utleverans.ArtikelNr)) ON Mottagare.MottagareNr = Order.MottagareNr
GROUP BY Order.Fraktsedel, Mottagare.Namn, Mottagare.Adress,
Mottagare.Postnr, Mottagare.Postadress, Order.KundNr, Order.LevDatum
PIVOT Lager.KategoriNr;
/ Rolf
Duane Hookom said:
Share your SQL view of the crosstab.
Did you enter all possible column headings into the Column Headings property
of the crosstab?
Is your "myform" open with a value in "mycontrol"?
--
Duane Hookom
MS Access MVP
Have made a qrosstab query that works fine. Have also been able to
use
the
wizard to generate a report from it. Then I got a problem when I
tried
to
let the query read the WHERE conditions from a form. I need to get only
the
records from a certain customer on a special day. So I used the format
[forms]![myform]![mycontrol]
It works when I only look at the result of the crosstab query, but then
something goes wrong, and I can confirm this fault, if I try to make a
report with help of the wizard. In the stage where to select the
fields,
there aren't any at all. It is just blank. But if I instead as a test put
those conditions in manually, the fields are there in the wizard.
I think Access in a way so to say, destroys the query when using those
references to a form, because it will never work again, even if I erase
them
to the original state, the wizard won't recognize any field for that
crosstab query any more. But with normal querys this problem does not
occur.
Is this possibly a flaw in Access? Can WHERE conditions instead be set
with
code for a crosstab query?
/ Rolf