R
Rob Parker
Hi All,
Apologies in advance for a rather long post. I've labelled this as a
repost, but it's not exactly. It's more a follow-up to an initial post I
made about a week ago, in the m.p.a.formscoding group (with the subject line
"Error 3463 with dCount - some computers only") and it's essentially the
same as my last post to that thread, two days ago, to which there has been
no further response. Since there's been no response there, I'm also
cross-posting to several groups this time around.
My initial problem was that a user of one of my applications gets the error
message "Run Time Error 3464 - Data type mismatch in criteria expression"
from the following line of code:
If DCount("*", "qryDocQualityReviewRemind") > 0 Then
This did not occur for all users; in particular, on my development system,
everything worked fine. And on the machine where the code failed, the query
itself (details below) ran OK. I've found the underlying cause of the
problem, but I'm still puzzled as to why certain things happen, and how to
best solve the problem.
Cause:
An Excel spreadsheet, accessed via a linked table, contains cells with a
space character, in a column which should contain date entries. The linked
table does not have a problem with the datatype for this field (table design
view of the linked table show it to be a DateTime field), but it does show
entries of #Num! for the cells which contain a space character in the linked
sheet.
Situation:
I am using links to a set of Excel sheets, not importing via code. The
links use the first row of the sheet as the field names.
The linked tables are used as the source for SELECT queries, which are then
combined in a Union query. Each Select query is similar to this:
SELECT "Technical Reports" AS DocGroup, [Technical Reports].ID, [Technical
Reports].Title, [Technical Reports].[Author/Prepared By] AS Author,
IIf(CVDate([Planned Issue Date])>CVDate(nz([Actual Issue
Date],0)),CVDate([Planned Issue Date]),Null) AS NRDate, CVDate([Next Quality
Review Date]) AS NQRDate
FROM [Technical Reports]
WHERE ((([Technical Reports].ID) Is Not Null));
The #Num! error from the linked table propagates into the output of this
query. A dCount on this query (in the Immediate window on my home system)
runs OK (unlike the dCount on another query (see below), which fails on some
systems - the reason for my original post).
The Select query above is one of several which are combined in this Union
query:
SELECT * FROM qryDocPlans
UNION ALL
SELECT * FROM qryDocProcedures
UNION ALL
SELECT * FROM qryDocChecklists
UNION ALL
SELECT * FROM qryDocSpecifications
UNION ALL
SELECT * FROM qryDocTechNotes
UNION ALL
SELECT * FROM qryDocTechReports
UNION ALL
SELECT * FROM qryDocWorkInstructions;
This Union query fails to run, giving the "Data type mismatch in criteria
expression" error.
The Union query is used in the following Select query
(qryDocQualityReviewRemind - the cause of my initial problem):
SELECT qryDocReview.DocGroup, qryDocReview.ID, qryDocReview.Title,
qryDocReview.Author, qryDocReview.NQRDate, tblDocQRevReminders.Printed
FROM qryDocReview LEFT JOIN tblDocQRevReminders ON (qryDocReview.NQRDate =
tblDocQRevReminders.NQRDate) AND (qryDocReview.ID = tblDocQRevReminders.ID)
WHERE (((tblDocQRevReminders.Printed)=False) AND
((DateAdd("d",-getconst("conDocRevRemind"),[qryDocReview].[NQRDate]))<=Date()))
OR (((tblDocQRevReminders.Printed) Is Null) AND
((DateAdd("d",-getconst("conDocRevRemind"),[qryDocReview].[NQRDate]))<=Date()))
ORDER BY qryDocReview.DocGroup, qryDocReview.ID;
This query does not fail on most of the systems I've tested it on, and a
dCount based on this query fails (with the "data type mismatch" error) on
some (but not all) systems.
Questions:
Why does the last query run on some systems and fail on some systems?
[Thought: is this possibly a Jet update/service pack issue?] And why, on at
least one system, does the query run but the dCount on the query fail?
How can I test for the #Num! entries (errors) in the first query (based on
the linked tables)? That would be the simplest method of preventing data
issues in the Excel sheets propagating into my queries, but I can't seem to
find anything that works - in particular, none of the error functions seem
to find anything wrong.
If I can't test for the #Num! entries in the linked tables, what other
alternatives do I have to solve this issue (how to cope with possible
datatype errors in the linked spreadsheet)?
TIA,
Rob
Apologies in advance for a rather long post. I've labelled this as a
repost, but it's not exactly. It's more a follow-up to an initial post I
made about a week ago, in the m.p.a.formscoding group (with the subject line
"Error 3463 with dCount - some computers only") and it's essentially the
same as my last post to that thread, two days ago, to which there has been
no further response. Since there's been no response there, I'm also
cross-posting to several groups this time around.
My initial problem was that a user of one of my applications gets the error
message "Run Time Error 3464 - Data type mismatch in criteria expression"
from the following line of code:
If DCount("*", "qryDocQualityReviewRemind") > 0 Then
This did not occur for all users; in particular, on my development system,
everything worked fine. And on the machine where the code failed, the query
itself (details below) ran OK. I've found the underlying cause of the
problem, but I'm still puzzled as to why certain things happen, and how to
best solve the problem.
Cause:
An Excel spreadsheet, accessed via a linked table, contains cells with a
space character, in a column which should contain date entries. The linked
table does not have a problem with the datatype for this field (table design
view of the linked table show it to be a DateTime field), but it does show
entries of #Num! for the cells which contain a space character in the linked
sheet.
Situation:
I am using links to a set of Excel sheets, not importing via code. The
links use the first row of the sheet as the field names.
The linked tables are used as the source for SELECT queries, which are then
combined in a Union query. Each Select query is similar to this:
SELECT "Technical Reports" AS DocGroup, [Technical Reports].ID, [Technical
Reports].Title, [Technical Reports].[Author/Prepared By] AS Author,
IIf(CVDate([Planned Issue Date])>CVDate(nz([Actual Issue
Date],0)),CVDate([Planned Issue Date]),Null) AS NRDate, CVDate([Next Quality
Review Date]) AS NQRDate
FROM [Technical Reports]
WHERE ((([Technical Reports].ID) Is Not Null));
The #Num! error from the linked table propagates into the output of this
query. A dCount on this query (in the Immediate window on my home system)
runs OK (unlike the dCount on another query (see below), which fails on some
systems - the reason for my original post).
The Select query above is one of several which are combined in this Union
query:
SELECT * FROM qryDocPlans
UNION ALL
SELECT * FROM qryDocProcedures
UNION ALL
SELECT * FROM qryDocChecklists
UNION ALL
SELECT * FROM qryDocSpecifications
UNION ALL
SELECT * FROM qryDocTechNotes
UNION ALL
SELECT * FROM qryDocTechReports
UNION ALL
SELECT * FROM qryDocWorkInstructions;
This Union query fails to run, giving the "Data type mismatch in criteria
expression" error.
The Union query is used in the following Select query
(qryDocQualityReviewRemind - the cause of my initial problem):
SELECT qryDocReview.DocGroup, qryDocReview.ID, qryDocReview.Title,
qryDocReview.Author, qryDocReview.NQRDate, tblDocQRevReminders.Printed
FROM qryDocReview LEFT JOIN tblDocQRevReminders ON (qryDocReview.NQRDate =
tblDocQRevReminders.NQRDate) AND (qryDocReview.ID = tblDocQRevReminders.ID)
WHERE (((tblDocQRevReminders.Printed)=False) AND
((DateAdd("d",-getconst("conDocRevRemind"),[qryDocReview].[NQRDate]))<=Date()))
OR (((tblDocQRevReminders.Printed) Is Null) AND
((DateAdd("d",-getconst("conDocRevRemind"),[qryDocReview].[NQRDate]))<=Date()))
ORDER BY qryDocReview.DocGroup, qryDocReview.ID;
This query does not fail on most of the systems I've tested it on, and a
dCount based on this query fails (with the "data type mismatch" error) on
some (but not all) systems.
Questions:
Why does the last query run on some systems and fail on some systems?
[Thought: is this possibly a Jet update/service pack issue?] And why, on at
least one system, does the query run but the dCount on the query fail?
How can I test for the #Num! entries (errors) in the first query (based on
the linked tables)? That would be the simplest method of preventing data
issues in the Excel sheets propagating into my queries, but I can't seem to
find anything that works - in particular, none of the error functions seem
to find anything wrong.
If I can't test for the #Num! entries in the linked tables, what other
alternatives do I have to solve this issue (how to cope with possible
datatype errors in the linked spreadsheet)?
TIA,
Rob