Microsoft Access crashing while doing a Union join query

V

Vi

Hi all,

I'm doing a union join on 2 select queries - but everytime I click on it, it
gives me the "Microsoft Access has encountered a problem and needs to
close...". I have successfully done other union joins in the same database
with no problems.

Can someone help me?

I am using the same datatype (text), below is the simple code:
SELECT
[T1].[NUMBER] as [NUMBER],
[T1].[FIRSTNAME] as [FIRSTNAME],
[T1].[LASTNAME] as [LASTNAME]
FROM [T1]

UNION SELECT
[T2].[NUMBER] as [NUMBER],
[T2].[FIRSTNAME] as [FIRSTNAME],
[T2].[LASTNAME] as [LASTNAME]
FROM [T2];

Thank you
V
 
J

John Spencer

That should work. You might try removing the aliases from the fields and see
what happens.


SELECT
[T1].[NUMBER] ,
[T1].[FIRSTNAME] ,
[T1].[LASTNAME]
FROM [T1]

UNION SELECT
[T2].[NUMBER] ,
[T2].[FIRSTNAME] ,
[T2].[LASTNAME]
FROM [T2];

John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
 
V

Vi

Hi,
Thanks for the advice - I tried removing the aliases and I still ended up
with that the same error that is telling me that Access is going to close...

V

John Spencer said:
That should work. You might try removing the aliases from the fields and see
what happens.


SELECT
[T1].[NUMBER] ,
[T1].[FIRSTNAME] ,
[T1].[LASTNAME]
FROM [T1]

UNION SELECT
[T2].[NUMBER] ,
[T2].[FIRSTNAME] ,
[T2].[LASTNAME]
FROM [T2];

John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
Hi all,

I'm doing a union join on 2 select queries - but everytime I click on it, it
gives me the "Microsoft Access has encountered a problem and needs to
close...". I have successfully done other union joins in the same database
with no problems.

Can someone help me?

I am using the same datatype (text), below is the simple code:
SELECT
[T1].[NUMBER] as [NUMBER],
[T1].[FIRSTNAME] as [FIRSTNAME],
[T1].[LASTNAME] as [LASTNAME]
FROM [T1]

UNION SELECT
[T2].[NUMBER] as [NUMBER],
[T2].[FIRSTNAME] as [FIRSTNAME],
[T2].[LASTNAME] as [LASTNAME]
FROM [T2];

Thank you
V
 
J

Jerry Whittle

What do the two select querys look like? As John said, they union query
should work. However is there something rather different in the other queries
like using functions?

If not the database may be corrupted. At times like this, nothing beats a
good backup. In fact make a complete backup of your database now and put it
away for safe keeping.

Tony Toews has an excellent web page on database corruption.
http://www.granite.ab.ca/access/corruptmdbs.htm

Allen Brown also has excellent info on corruption.
http://allenbrowne.com/ser-47.html

I have a white paper in a Word document named Fix Corrupt Access Database
towards the bottom this page:
http://www.rogersaccesslibrary.com/OtherLibraries.asp
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


Vi said:
Hi,
Thanks for the advice - I tried removing the aliases and I still ended up
with that the same error that is telling me that Access is going to close...

V

John Spencer said:
That should work. You might try removing the aliases from the fields and see
what happens.


SELECT
[T1].[NUMBER] ,
[T1].[FIRSTNAME] ,
[T1].[LASTNAME]
FROM [T1]

UNION SELECT
[T2].[NUMBER] ,
[T2].[FIRSTNAME] ,
[T2].[LASTNAME]
FROM [T2];

John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
Hi all,

I'm doing a union join on 2 select queries - but everytime I click on it, it
gives me the "Microsoft Access has encountered a problem and needs to
close...". I have successfully done other union joins in the same database
with no problems.

Can someone help me?

I am using the same datatype (text), below is the simple code:
SELECT
[T1].[NUMBER] as [NUMBER],
[T1].[FIRSTNAME] as [FIRSTNAME],
[T1].[LASTNAME] as [LASTNAME]
FROM [T1]

UNION SELECT
[T2].[NUMBER] as [NUMBER],
[T2].[FIRSTNAME] as [FIRSTNAME],
[T2].[LASTNAME] as [LASTNAME]
FROM [T2];

Thank you
V
 
J

John W. Vinson

Hi all,

I'm doing a union join on 2 select queries - but everytime I click on it, it
gives me the "Microsoft Access has encountered a problem and needs to
close...". I have successfully done other union joins in the same database
with no problems.

Very odd. What version of Access? How big are the tables? Are the datatypes
and sizes of the fields the same between the two tables?
 
V

Vi

Hi all,

Thanks very much for the help.
V

John W. Vinson said:
Very odd. What version of Access? How big are the tables? Are the datatypes
and sizes of the fields the same between the two tables?
 

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