Computer Learning Zone CLZ Access Excel Word Windows

Free advice is seldom cheap.

-59th Rule of Acquisition
 
Home   Courses   Index   Templates   Seminars   TechHelp   Forums   Help   Contact   Join   Order   Logon  
 
Home > TechHelp > Access >
Back to TechHelp    Comments List
Join with extra conditions Upload Images   Link   Email  
James Swanson      
13 months ago
The following appears to be correct with generic SQL syntax, however, I get an error "JOIN expression not supported" when I try to use it in Access:

SELECT Contact.*, Properties.HouseNumber & " " & Trim(Properties.DirectionPrefix & " " & Properties.Street & " " & Properties.StreetType & " " & Properties.DirectionSuffix) & Trim(" " & Properties.SuiteNo) AS Addr1, Trim(Properties.City & ", " & Properties.State & "  " & Properties.Zip) AS Addr2
FROM Contact LEFT JOIN Properties
ON Contact.Key = Properties.Contact_Key
AND "primary"=PropertyType

Any suggestions?? I only want the client's PRIMARY property to show up.
Kevin Robertson            
13 months ago
The PropertyType needs to be a WHERE condition.

SELECT Contact.*, Properties.HouseNumber & " " & Trim(Properties.DirectionPrefix & " " & Properties.Street & " " & Properties.StreetType & " " & Properties.DirectionSuffix) & Trim(" " & Properties.SuiteNo) AS Addr1, Trim(Properties.City & ", " & Properties.State & "  " & Properties.Zip) AS Addr2, Properties.PropertyType
FROM Contact LEFT JOIN Properties ON Contact.Key = Properties.Contact_Key
WHERE Properties.PropertyType="Primary";


In the Query designer you can simply add "Primary" to the criteria of the PropertyType column.
James Swanson      
13 months ago
That is correct and how I originally wrote it. However, this way I do not get any of the cases where a contact does not have a "primary" property. I don't always have an address for every contact. This is standard SQL and should work.

I tried something that fixed it. Access needs to group the condition with additional syntax: "FROM Contact LEFT JOIN Properties
ON (Contact.Key = Properties.Contact_Key
AND "primary"=properties.PropertyType)"

Adding the "()" helps the parser to interpret both conditions as part of the JOIN not part of the SELECT.

Thanks for your help.
James Swanson      
13 months ago
OK. That's weird. When I make the change in my form and test it by executing it I get all the records as expected with NULL address info on a few records. Then, when I save it, close it, and reopen it, I get the old error message. Access won't even let me edit by clicking on the three dots in Record Source. I can review and edit within that one line and discover that Access has removed the "()" so it looks like this: "FROM Contact LEFT JOIN Properties ON Contact.Key = Properties.Contact_Key
AND "primary"=properties.PropertyType".

DO you have any suggestions how I might get this reported to Microsoft as a bug?
James Swanson      
13 months ago
I fixed it by creating a query with the correct syntax and then using that query as the record source.

WHEW!

This thread is now CLOSED. If you wish to comment, start a NEW discussion in TechHelp.
 

 
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2024 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 4/22/2024 12:57:23 PM. PLT: 0s
xxx