Error when running Query

C

Carol

I have the following queries set up in my database that were working a week
ago. Now I am getting the error "Invalid procedure call" when I try to run
any of them. I will list each of them, and paste the SQL. I will also past
the SQL from the one query that is working.

I don't understand why they worked a week ago and not now. I checked the
data in the tables to make sure that the expressions contained would return
valid results. So far I haven't seen anything that would crash the
expression.

Please take a look at these queries and let me know if you see anything.

Thanks,
Carol

Query #1 - TASK LIST. The user is queried for the section and it will
return all entries with that section. THIS QUERY IS WORKING.

SELECT MAIN.ID, MAIN.DEPT, MAIN.SECTION, MAIN.TASK, MAIN.[PROF MAIL DATE],
MAIN.[EST TIME (HR)], MAIN.[LAST COMPLETED DATE], DateAdd([FREQ
INTERVAL],[FREQ NUMBER],[LAST COMPLETED DATE]) AS Expr1, MAIN.[RESPONSIBLE
PARTY], MAIN.CATEGORY, MAIN.Notes, MAIN.FREQ, MAIN.[FREQ INTERVAL],
MAIN.[FREQ NUMBER], MAIN.[CATEGORY INTERVAL], MAIN.[CATEGORY NUMBER],
DateAdd([CATEGORY INTERVAL],[CATEGORY NUMBER],DateAdd([FREQ INTERVAL],[FREQ
NUMBER],[LAST COMPLETED DATE])) AS Expr2
FROM MAIN
WHERE (((MAIN.DEPT)="LAB") AND ((MAIN.SECTION) Like [Enter Section]) AND
((MAIN.[FREQ INTERVAL]) Is Not Null) AND ((MAIN.[FREQ NUMBER]) Is Not Null)
AND ((MAIN.[CATEGORY INTERVAL]) Is Not Null) AND ((MAIN.[CATEGORY NUMBER]) Is
Not Null))
ORDER BY MAIN.TASK, DateAdd([FREQ INTERVAL],[FREQ NUMBER],[LAST COMPLETED
DATE]);

Query #2 - TASK LIST ALL - This is the same query as #1, but without the
section query. It will return all entries.

SELECT MAIN.ID, MAIN.DEPT, MAIN.SECTION, MAIN.TASK, MAIN.[PROF MAIL DATE],
MAIN.[EST TIME (HR)], MAIN.[LAST COMPLETED DATE], DateAdd([FREQ
INTERVAL],[FREQ NUMBER],[LAST COMPLETED DATE]) AS Expr1, MAIN.[RESPONSIBLE
PARTY], MAIN.CATEGORY, MAIN.Notes, MAIN.FREQ, MAIN.[FREQ INTERVAL],
MAIN.[FREQ NUMBER], MAIN.[CATEGORY INTERVAL], MAIN.[CATEGORY NUMBER],
DateAdd([CATEGORY INTERVAL],[CATEGORY NUMBER],DateAdd([FREQ INTERVAL],[FREQ
NUMBER],[LAST COMPLETED DATE])) AS Expr2
FROM MAIN
WHERE (((MAIN.DEPT)="LAB") AND ((MAIN.[FREQ INTERVAL]) Is Not Null) AND
((MAIN.[FREQ NUMBER]) Is Not Null) AND ((MAIN.[CATEGORY INTERVAL]) Is Not
Null) AND ((MAIN.[CATEGORY NUMBER]) Is Not Null))
ORDER BY MAIN.TASK, DateAdd([FREQ INTERVAL],[FREQ NUMBER],[LAST COMPLETED
DATE]);

Query #3 - DATE QUERY - This will query the user for a start date, end date
and section.
PARAMETERS [Enter Start Date] DateTime, [Enter End Date] DateTime;
SELECT MAIN.ID, MAIN.DEPT, MAIN.SECTION, MAIN.TASK, MAIN.[PROF MAIL DATE],
MAIN.[EST TIME (HR)], MAIN.[LAST COMPLETED DATE], DateAdd([FREQ
INTERVAL],[FREQ NUMBER],[LAST COMPLETED DATE]) AS Expr1, MAIN.[RESPONSIBLE
PARTY], MAIN.CATEGORY, MAIN.Notes, MAIN.FREQ, MAIN.[FREQ INTERVAL],
MAIN.[FREQ NUMBER], MAIN.[CATEGORY INTERVAL], MAIN.[CATEGORY NUMBER],
DateAdd([CATEGORY INTERVAL],[CATEGORY NUMBER],DateAdd([FREQ INTERVAL],[FREQ
NUMBER],[LAST COMPLETED DATE])) AS Expr2
FROM MAIN
WHERE (((MAIN.DEPT)="LAB") AND ((MAIN.SECTION) Like [Enter Section]) AND
((DateAdd([FREQ INTERVAL],[FREQ NUMBER],[LAST COMPLETED DATE])) Between
[Enter Start Date] And [Enter End Date]) AND ((MAIN.[FREQ INTERVAL]) Is Not
Null) AND ((MAIN.[FREQ NUMBER]) Is Not Null) AND ((MAIN.[CATEGORY INTERVAL])
Is Not Null) AND ((MAIN.[CATEGORY NUMBER]) Is Not Null));

Query #4 - DATE QUERY ALL SECTIONS - This will query the user for a start
and end date.
PARAMETERS [Enter Start Date] DateTime, [Enter End Date] DateTime;
SELECT MAIN.ID, MAIN.DEPT, MAIN.SECTION, MAIN.TASK, MAIN.[PROF MAIL DATE],
MAIN.[EST TIME (HR)], MAIN.[LAST COMPLETED DATE], DateAdd([FREQ
INTERVAL],[FREQ NUMBER],[LAST COMPLETED DATE]) AS Expr1, MAIN.[RESPONSIBLE
PARTY], MAIN.CATEGORY, MAIN.Notes, MAIN.FREQ, MAIN.[FREQ INTERVAL],
MAIN.[FREQ NUMBER], MAIN.[CATEGORY INTERVAL], MAIN.[CATEGORY NUMBER],
DateAdd([CATEGORY INTERVAL],[CATEGORY NUMBER],DateAdd([FREQ INTERVAL],[FREQ
NUMBER],[LAST COMPLETED DATE])) AS Expr2
FROM MAIN
WHERE (((MAIN.DEPT)="LAB") AND ((DateAdd([FREQ INTERVAL],[FREQ NUMBER],[LAST
COMPLETED DATE])) Between [Enter Start Date] And [Enter End Date]) AND
((MAIN.[FREQ INTERVAL]) Is Not Null) AND ((MAIN.[FREQ NUMBER]) Is Not Null)
AND ((MAIN.[CATEGORY INTERVAL]) Is Not Null) AND ((MAIN.[CATEGORY NUMBER]) Is
Not Null));
 
J

John Vinson

I have the following queries set up in my database that were working a week
ago. Now I am getting the error "Invalid procedure call" when I try to run
any of them. I will list each of them, and paste the SQL. I will also past
the SQL from the one query that is working.

One possibility is that your VBA project is corrupt. Try Tools...
Database Utilities... Compact and Repair; then type Ctrl-G to open the
VBA editor and select Debug... Compile <your database>. Correct any
VBA errors.

You may also want to check for broken references: with the VBA editor
open select Tools... References. If any references are marked MISSING,
doublecheck that the .DLL or other file is in fact where it's supposed
to be; uncheck that checkbox and, if you do in fact need that library,
recheck it. Close and open Access and see if the problem resolves.

John W. Vinson[MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top