Re: Can't make a report from crosstab query
- From: "Rolf Rosenquist" <rolf@xxxxxxxxxx>
- Date: Wed, 26 Jul 2006 13:13:30 +0200
I said in my last answer to you:
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.
Now I have found a little bit more. When the normal query should be
generated by code, I notice once more, that the fields in the crosstab query
don't appear. That's the same error as in the wizard, because when stepping
through the code, it jumps right over the "For Each fld in qdf.Fields" and
when holding the cursor over the rs, qdf and fld in the Dim statements it
says "=Nothing" .
Sub CreateReportQuery()
On Error GoTo Err_CreateQuery
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim qdf As DAO.QueryDef
Dim fld As DAO.Field
Dim indexx As Integer
Dim FieldList As String
Dim strSQL As String
Dim I As Integer
Set db = CurrentDb
Stop
'*** Korsfrågan ***
Set qdf = db.QueryDefs("xfrManifest")
indexx = 0
For Each fld In qdf.Fields
If fld.Type >= 1 And fld.Type <= 8 Or fld.Type = 10 Then
FieldList = FieldList & "[" & fld.Name & "] as Field" & indexx &
", "
ReportLabel(indexx) = fld.Name
End If
indexx = indexx + 1
Next fld
............
So it seems to me that the crosstab query gets corrupt each time I use a
selection based on a control in a form. Even when I remove it, so that there
is no selection at all, I still get the same result. The only way to make it
run (without selections or with selection manually input as with KundNr=2)
is to rewrite it from scratch. That I think, could perhaps be a flaw in
Access...?
/ Rolf
"Duane Hookom" <DuaneAtNoSpanHookomDotNet> skrev i meddelandet
news:OE68GPFsGHA.1288@xxxxxxxxxxxxxxxxxxxxxxx
You did not "enter all possible column headings into the Column Headingsview
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
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
.
- Follow-Ups:
- Re: Can't make a report from crosstab query
- From: Duane Hookom
- Re: Can't make a report from crosstab query
- References:
- Can't make a report from crosstab query
- From: Rolf Rosenquist
- Re: Can't make a report from crosstab query
- From: Duane Hookom
- Re: Can't make a report from crosstab query
- From: Rolf Rosenquist
- Re: Can't make a report from crosstab query
- From: Duane Hookom
- Re: Can't make a report from crosstab query
- From: Rolf Rosenquist
- Can't make a report from crosstab query
- Prev by Date: How to run query by using string variable?
- Next by Date: Re: Please help! (Reports and Queries)
- Previous by thread: Re: Can't make a report from crosstab query
- Next by thread: Re: Can't make a report from crosstab query
- Index(es):
Relevant Pages
|