Help on ERROR 3075

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I have an error on the following query:

SELECT HiPlanNames_2004_Final.* INTO 2004_HiPlanNames_ADD
FROM HiPlanNames_2004_Final
WHERE (((Left([SOURCE1],2))="04")) OR (((Left([SOURCE2],2))="04")) OR
(((Left([SOURCE3],2))="04")) OR (((Left([SOURCE4],2))="04")) OR
(((Left([SOURCE5],2))="04"));

The message says "Compile error in query expression..." then it list the
where clause. I can't seem to see where the problem is.

Can anybody help?

Thanks.
 
Try:

INSERT INTO 2004_HiPlanNames_ADD
SELECT HiPlanNames_2004_Final.*
FROM HiPlanNames_2004_Final
WHERE Left([SOURCE1],2)="04" Or Left([SOURCE2],2)="04" Or
Left([SOURCE3],2)="04" OR Left([SOURCE4],2)="04" OR
Left([SOURCE5],2)="04";

The extra parentheses are ok, but shouldn't be needed.
 
Could be a references problem.

Do a Ctrl + g and past the following in the Immediate window.

Debug.Print Left("Testing",2)

It should return Te with no errors. If there are errors go up to Tools,
References. There should be at least 4 things selected and nothing near the
top saying Missing. If Missing, you need to find that file by clicking on the
Browse button.
 
Jerry,

The Immediate window returns correctly...and the references are all right.
Any other ideas, please?

Jerry Whittle said:
Could be a references problem.

Do a Ctrl + g and past the following in the Immediate window.

Debug.Print Left("Testing",2)

It should return Te with no errors. If there are errors go up to Tools,
References. There should be at least 4 things selected and nothing near the
top saying Missing. If Missing, you need to find that file by clicking on the
Browse button.


--
Jerry Whittle
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


Luther said:
Hi,

I have an error on the following query:

SELECT HiPlanNames_2004_Final.* INTO 2004_HiPlanNames_ADD
FROM HiPlanNames_2004_Final
WHERE (((Left([SOURCE1],2))="04")) OR (((Left([SOURCE2],2))="04")) OR
(((Left([SOURCE3],2))="04")) OR (((Left([SOURCE4],2))="04")) OR
(((Left([SOURCE5],2))="04"));

The message says "Compile error in query expression..." then it list the
where clause. I can't seem to see where the problem is.

Can anybody help?

Thanks.
 
Are the SourceX fields numbers or text? The Left() function should return
text, but I wonder if it's not converting properly? Also, a "compile error"
is unusual. I thought it may have resulted from an error elsewhere in the
query and was being misinterpreted as being in the WHERE clause. If you had
a References problem, while it would be a compile error, I would expect
something more like "undefined function 'Left' in the WHERE clause".

Are you writing this query in Access to be run against an Access file or is
the running against a SQL server or some other database server?

--
Wayne Morgan
MS Access MVP


Luther said:
Thanks, Wayne. But no luck. It did'nt work

Luther said:
Hi,

I have an error on the following query:

SELECT HiPlanNames_2004_Final.* INTO 2004_HiPlanNames_ADD
FROM HiPlanNames_2004_Final
WHERE (((Left([SOURCE1],2))="04")) OR (((Left([SOURCE2],2))="04")) OR
(((Left([SOURCE3],2))="04")) OR (((Left([SOURCE4],2))="04")) OR
(((Left([SOURCE5],2))="04"));

The message says "Compile error in query expression..." then it list the
where clause. I can't seem to see where the problem is.

Can anybody help?

Thanks.
 
The SourceX fields are text; that is exactly why I used the Left() function
to extract the first 2 characters. This query is also written in Access to be
run against an Access file. I read somewhere that I may have to re-register
libraries. How do they become unregistered? If so, how do I know which ones
to do?

Any thoughts on this, please?

Wayne Morgan said:
Are the SourceX fields numbers or text? The Left() function should return
text, but I wonder if it's not converting properly? Also, a "compile error"
is unusual. I thought it may have resulted from an error elsewhere in the
query and was being misinterpreted as being in the WHERE clause. If you had
a References problem, while it would be a compile error, I would expect
something more like "undefined function 'Left' in the WHERE clause".

Are you writing this query in Access to be run against an Access file or is
the running against a SQL server or some other database server?

--
Wayne Morgan
MS Access MVP


Luther said:
Thanks, Wayne. But no luck. It did'nt work

Luther said:
Hi,

I have an error on the following query:

SELECT HiPlanNames_2004_Final.* INTO 2004_HiPlanNames_ADD
FROM HiPlanNames_2004_Final
WHERE (((Left([SOURCE1],2))="04")) OR (((Left([SOURCE2],2))="04")) OR
(((Left([SOURCE3],2))="04")) OR (((Left([SOURCE4],2))="04")) OR
(((Left([SOURCE5],2))="04"));

The message says "Compile error in query expression..." then it list the
where clause. I can't seem to see where the problem is.

Can anybody help?

Thanks.
 
If it is a References problem, then see this link. The problem reference may
not be the reference to the library that is causing you the problem.

http://www.allenbrowne.com/ser-38.html

If you need to reregister the libraries, it is probably easiest to do a
repair install of Office. Go to Help|Detect and Repair...
 
Back
Top