G
Guest
Answers to your questions:
1. Yes
2. Yes - default value is =DateAdd("d",2-Weekday(Date()),Date()+7)
3. Yes - Activity = Text but both were different in field size, made them
both 20 now
SpecialistID = Autonumber and Specialist = Long Integer
CountryCode = Text, 2 in both
4. CountryCode holds the values A, B, C, etc and this is meaningless to the
user so I have another field called Distributor in the Distributor Codes
table that holds the name of the Country (eg UK, Germany etc). This is used
as the first grouping level
5. The sorting order is the same in the query as the grouping in the report
6. It is 2003 SP1, part of Office Prof 2003 run on terminal services (Win
2003 Server)
7. Not sure how to check version of Jet ? Not applied anything other than
all windows updates...
1. Yes
2. Yes - default value is =DateAdd("d",2-Weekday(Date()),Date()+7)
3. Yes - Activity = Text but both were different in field size, made them
both 20 now
SpecialistID = Autonumber and Specialist = Long Integer
CountryCode = Text, 2 in both
4. CountryCode holds the values A, B, C, etc and this is meaningless to the
user so I have another field called Distributor in the Distributor Codes
table that holds the name of the Country (eg UK, Germany etc). This is used
as the first grouping level
5. The sorting order is the same in the query as the grouping in the report
6. It is 2003 SP1, part of Office Prof 2003 run on terminal services (Win
2003 Server)
7. Not sure how to check version of Jet ? Not applied anything other than
all windows updates...
Allen Browne said:When I'm debugging, I try to break things down into small mouthfuls, and
check each step from the bottom up. Some things have clearly changed since
we started, so lets see where we are at now.
I assume:
1. Specialists, Itinerary, and [Distributor Codes (ECS created)] are all
tables, i.e. there are no lower-level queries where things could go wrong.
2. [forms]![frm report menu]![StartDate] is the unbound text box. On your
form this text box has its Format property set to Short Date. The form is
open. There is a value in the text box. The focus has left the box (so the
Value has been processed.)
3. The data *type* and *size* of the fields in the join is exactly the same,
i.e.:
- Itinerary.Activity and tblActivity.Activity are the same type and size.
- [Distributor Codes (ECS created)].CountryCode and Itinerary.CountryCode.
- Specialists.SpecialistID = Itinerary.Specialist.
Now, I am confused how you manage your first grouping level: the query is
not returning the CountryCode, so I don't see how that can be the first item
in the Sorting And Grouping box on your report.
Ideally, arrange the GROUP BY clause in the same order as the fields in the
Sorting And Grouping box.
Also, we don't know what version of Access this is, or the service pack of
JET you have applied.
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Reply to group, rather than allenbrowne at mvps dot org.
hughess7 said:Thanks Allen
The only parameter is the StartDate field which is a shortdate format. I
have already deleted all the functions from the report so it is using the
query fields only at the moment.
PARAMETERS [forms]![frm report menu]![StartDate] DateTime;
TRANSFORM Count(Itinerary.ReviewDate) AS ActivityCount
SELECT [Distributor Codes (ECS created)].Distributor,
Specialists.Specialist, tblActivity.Productive, Itinerary.Activity,
Sum([ActivityCount]) AS [Total Of Activity]
FROM Specialists INNER JOIN ([Distributor Codes (ECS created)] INNER JOIN
(Itinerary INNER JOIN tblActivity ON Itinerary.Activity =
tblActivity.Activity) ON [Distributor Codes (ECS created)].CountryCode =
Itinerary.CountryCode) ON Specialists.SpecialistID = Itinerary.Specialist
WHERE (((DatePart("yyyy",[ReviewDate]))=DatePart("yyyy",[forms]![frm
report
menu]![startdate])))
GROUP BY [Distributor Codes (ECS created)].Distributor,
Specialists.Specialist, tblActivity.Productive, Itinerary.Activity
PIVOT DatePart("m",[ReviewDate]) In (1,2,3,4,5,6,7,8,9,10,11,12);
Sue
Allen Browne said:Post the SQL statement from the crosstab query.
Let's see if we can typecast the fields.
And please indicate if there is a parameter in the query.
Temporarily drop the functions from the report, to see if that makes a
difference. The function itself may be erroring.
No the report is based on a crosstab query so therefore they are
groupby
fields, I don't know any other way to display the data in the format I
want
to view it (eg rows and columns spreadsheet style), but I still need
the
report to do some grouping and, for example, not to print the
specialist
against every row but in a header instead.
There also will be calculated control calling other functions (to
calculate
working days etc) but I haven't got that far yet as it keeps failing!
If I
add the Productive group the whole report layout is messing up.
Are you saying I shouldn't be able to do all this?
:
So you can get the report to fail with just 3 grouping levels:
Country
Specialist
Productive (Yes/No type field)
This happens even though:
- the report is bound directly to a table (not a query that is doing
prior
ORDER BY or GROUP BY);
- there is no code in the events of the report (i.e. the report's
HasModule
property os No);
- there are no calculated fields on the report that are calling other
functions.
If so, you have a situation I have not seen.
You have already done a repair, so a bad index is unlikely.
Nevertheless,
you might consider breaking any relation on Country and Specialist,
removing
any indexes on these fields (including hidden indexes), compacting,
and
then
recreating the indexes and relations.
If you have not previously checked that you have SP8 for JET 4 and the
latest service pack for your version of Office, get these from:
http://support.microsoft.com/gp/sp
There was a problem with Access 2002 SP3 throwing the 'No Current
Record'
error in a form after deleting a record, but you can't delete in a
report
so
I doubt that is relevant.
Not sure what else to suggest.
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Reply to group, rather than allenbrowne at mvps dot org.
After compact and repair its working again but I rebuilt piece by
piece
to
test each thing. The problem seems to lie with the Productive field.
This
is
a Yes/No field and determines whether an activity is deemed
productive
or
non-productive. I wanted the report to group by country first, then
specialist, then on productive activities and totals and
non-productive
activies and totals. Adding the Productive group header messes
everything
up
and the report starts to error with No Current Record
:
Unfortunately as I have started to further build my report the
problem
became
apparent again with no current record. It doesnt produce the jet db
error
though.
It is a complicated report based on a crosstab query and I am
trying
to
add
quite a few grouping levels.
This is getting very frustrating :-(
:
You can definately run into problems with mismatches and
inconsistent
results if the field type and the criteria type don't match.
Using a Date/Time type field, and a Date/Time type value in the
criteria is
highly desirable if that's the kind of data you are dealing with.
In fact, you have to work hard at getting JET 4 to recognise
calculated
date
fields as the right type, and you have to work at getting Access
to
recognise unbound text boxes as dates, so you can get consistent
results.
This article explains how:
Calculated fields misinterpreted
at:
http://allenbrowne.com/ser-45.html
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Reply to group, rather than allenbrowne at mvps dot org.
It is a text field not a date field. Its default value is set
to:
=Format(DateAdd("m",-1,Date()),"mmmyy")
Then in the query the criteria is Right([reviewdate],2) =
Right([forms]![frm
report menu]![DateFilter],2).
It is done this way as another report uses the DateFilter which
has
these
same values (eg JAN05) stored in a tables text field called
ReportingMonth,
which identify whether a record has been reported on or not and
in
which
month/year if so.
For this new report I have the problem with it filters on
ReviewDate
which
is an actual date field so I think maybe I should change it to
one
of
your
dateserial examples using a date field on the form. I also have
one
called
startdate which defaults to the following Monday's day to print
out
weekly
itineraries. Do you think this is maybe the problem because its
not
an
actual
date field?
:
Okay, so the text box displays the date in mmmyy format.
It might make a difference to the behavior of the reports
whether
this
text
box actually gets assigned a *date*, as in:
Me.DateFilter = DateSerial(Year(Date), Month(Date)-1, 1)
or whether it gets assigned as *string* value, such as:
Me.DateFilter = Format(DateSerial(Year(Date),
Month(Date)-1,
1),
"mmmyy")
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Reply to group, rather than allenbrowne at mvps dot org.
message
Sorry for the confusion, DateFilter is an unbound text field
on
a
form
(which
is called frm report menu). When the form is opened
DateFilter
is
defaulted
to the current year and month-1 eg at the moment it will
show
JUL05.
I have various reports/queries that use this to filter which
records to
show.
message
Story so far...
I made a new db and imported all objects then followed
your
step by
step
instructions. The problem still occurs so I am now
looking
at
the
recovering
from corruption articles.
One thing, when I imported all the objects to a new db
there
were