union query weirdness

dott

Registered User.
Local time
Today, 14:49
Joined
Jun 24, 2003
Messages
56
here is my union query:

SELECT RIMcontracts.[tno], contractors.[Contractor Name], contractors.[Phone Number], RIMcontracts.[Project No], RIMcontracts.[wdate], RIMcontracts.[idate], RIMcontracts.[ndate]
FROM contractors INNER JOIN RIMcontracts ON contractors.[Contractor Name] = RIMcontracts.[Contractor Name]
UNION SELECT WINcontracts.[tno], contractors.[Contractor Name], contractors.[Phone Number], WINcontracts.[Project No], WINcontracts.[wdate], WINcontracts.[idate], WINcontracts.[ndate]
FROM contractors INNER JOIN WINcontracts ON contractors.[Contractor Name] = WINcontracts.[Contractor Name];


my query works fine but for some reason it is cutting off the first 3 letters in my [Project No] field

in my WINcontracts and my RIMcontracts tables the field is enforced with a input mask of "WIN-"0000\->>>AAAAAA and "RIM-"0000\->>>AAAAAA respectively. I'm thinking this is where the problem is coming from, i am not sure. But when i open up the tables it shows the string just fine, with the first 3 letters and all.

So i dont want it to strip those letters off of the field because then i cant tell the contracts apart. anyway around this?
 
Last edited:
I guess i could just have my query select only the rim contracts us ing a query (which does not cut off the first 3 characters) and then have a subreport using another query that selects only the WIN contracts underneath it

but it seems like i should be able to do it with a union query
 
i just re-wrote my query by hand to come up with the following which put me a half step closer to where i want to be:

SELECT RIMcontracts.[Tendor No], contractors.[Phone Number], RIMcontracts.[Project No], RIMcontracts.[WCB Valid Date], RIMcontracts.[Insurance Valid Date], RIMcontracts.[NSCSA Valid Date], contractors.[Contractor Name]
FROM contractors, RIMcontracts
WHERE (((contractors.[Contractor Name])=[RIMcontracts].[Contractor Name])) UNION
SELECT WINcontracts.[Tendor No], contractors.[Phone Number], WINcontracts.[Project No], WINcontracts.[WCB Valid Date], WINcontracts.[Insurance Valid Date], WINcontracts.[NSCSA Valid Date], contractors.[Contractor Name]
FROM contractors, WINcontracts
WHERE (((contractors.[Contractor Name]) = WINcontracts.[Contractor Name]));

(Access aded the brackets in the WHERE clause, anyone know why it needs them?)

Now its setting up all of my project no's as RIM-BLAH regardless if it should start with RIM or WIN?

whats going on???
 

Users who are viewing this thread

Back
Top Bottom