473,320 Members | 2,035 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Stop Access from reformatting and breaking my SQL statements

I am using Access 2000.

I have a query that I enter in sql that performs a left join:

SELECT person.*,phone.* FROM
person
LEFT JOIN
phone
ON ((phone.person_id=person.person_id) AND (phone.type='home'));

If I type it in and use it, it runs GREAT until I try to open it back
up in design view. At that point, Access reformats it by stripping out
the outter parenthesis of the ON clause. Then the Jet engine gives me
an error "Join Not supported" and closes the query so I can't even edit
it and fix it.

THIS SUCKS!

<retorical>Why does it close the query and prevent me from fixing the
problem that it made?</retorical>

Does anybody know how to prevent Access from stripping the outter
parenthesis?

(And please don't tell me to move part of the ON clause into a WHERE
clause becasue that doesn't result in the same query.
muchas gracias,
Dean

Nov 13 '05 #1
5 2406
re******@bigfoot.com wrote:
I am using Access 2000.

I have a query that I enter in sql that performs a left join:

SELECT person.*,phone.* FROM
person
LEFT JOIN
phone
ON ((phone.person_id=person.person_id) AND (phone.type='home'));

If I type it in and use it, it runs GREAT until I try to open it back
up in design view. At that point, Access reformats it by stripping out
the outter parenthesis of the ON clause. Then the Jet engine gives me
an error "Join Not supported" and closes the query so I can't even edit
it and fix it.

THIS SUCKS!

<retorical>Why does it close the query and prevent me from fixing the
problem that it made?</retorical>

Does anybody know how to prevent Access from stripping the outter
parenthesis?


That is why I wrote NavQueries. Get it from my site. Er, it may not be
A2K-prepared--expect to change some declarations "As Recordset" to "As
DAO.Recordset"

--
Bas Cost Budde, Holland
http://www.heuveltop.nl/BasCB/msac_index.html
I prefer human mail above automated so in my address
replace the queue with a tea
Nov 13 '05 #2
I made a quick mockup of the tables (with the fields you've given,
adding a "name" to person, and "number" to phone for display), and
you're right the queries are different using WHERE.

The only difference though is that with a WHERE, the recordset is
editable, but with yours it is not.

Being that I don't have your exact data, maybe I'm missing the change
you're describing. Can you elaborate?

Nov 13 '05 #3
Here is an example:
person table:(person_id,name)
1 bob

phone table:(phone_id,person_id,number,type)
1 1 555-1111 work

SELECT person.*,phone.* FROM person LEFT JOIN phone
ON ((phone.person_id=person.person_id) AND (phone.type='home'));

should return (1,bob,null,null,null,null ) since there is no home
phone.

SELECT person.*,phone.* FROM person LEFT JOIN phone
ON phone.person_id=person.person_id
WHERE phone.type='home'

would first do the left join creating a row like:
1,bob,1,1,'555-1111',work

and then the WHERE clause would weed out the row entirely leaving
nothing.

Without the type='home' clause in the ON clause, you can't get NULL
values from the phone table unless there are no corresponding phone
records at all.

I understand the difficulty in seeing it. I couldn't until I had a
table full of data and ran the query and found that everyone listed
seemed to have a home phone.

Nov 13 '05 #4
Bri
Hi,

You could also accomplish this with a subquery in the From clause.
This works in AC97 so it should work in all newer versions too:

SELECT person.*,ph.* FROM person LEFT JOIN
[SELECT phone.* FROM phone WHERE phone.type='home';]. AS ph
ON person.person_id=ph.person_id

--
Bri

re******@bigfoot.com wrote:
Here is an example:
person table:(person_id,name)
1 bob

phone table:(phone_id,person_id,number,type)
1 1 555-1111 work

SELECT person.*,phone.* FROM person LEFT JOIN phone
ON ((phone.person_id=person.person_id) AND (phone.type='home'));

should return (1,bob,null,null,null,null ) since there is no home
phone.

SELECT person.*,phone.* FROM person LEFT JOIN phone
ON phone.person_id=person.person_id
WHERE phone.type='home'

would first do the left join creating a row like:
1,bob,1,1,'555-1111',work

and then the WHERE clause would weed out the row entirely leaving
nothing.

Without the type='home' clause in the ON clause, you can't get NULL
values from the phone table unless there are no corresponding phone
records at all.

I understand the difficulty in seeing it. I couldn't until I had a
table full of data and ran the query and found that everyone listed
seemed to have a home phone.


Nov 13 '05 #5
Thanks Bri! That does it!

Nov 13 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: Dave | last post by:
After following Microsofts admonition to reformat my system before doing a final compilation of my app I got many warnings/errors upon compiling an rtf file created in word. I used the Help...
11
by: maryjones11289 | last post by:
Hi, I have an app (lost the source code) that performs many different queries in order to achieve the results I'm looking for. Re-developing the app isn't really a big issue...but what would be...
12
by: clintonG | last post by:
VS2005 2.0 Beta 2 noting I've posted (to no avail so far) to the somewhat deadzone at news://microsoft.public.vsnet.ide and am getting ants in my pants for some discussion about this issue. ...
3
by: Chris Lane | last post by:
Hi, This is super annoying FrontPage like behavior. Does anybody know how I can stop the Visual Studio.NET IDE from reformatting my HTML? Thank You
6
by: Abhishek Srivastava | last post by:
Hello All, I am developing a page which has a complex layout. This layout cannot be made using VS alone, so I have to go into the html view and edit the html myself. The problem is that...
8
by: carriolan | last post by:
Hi I have an MS Access based application almost ready for distribution to the public and I find that even though I have compiled it into an MDE file, tables and queries can still be be imported if...
3
by: diego | last post by:
Greetings everyone! Is there a way to stop query analyzer from processing remaining query statements? Let's say i have the following query in query analyzer: query statements if condition...
16
by: Neil | last post by:
I posted a few days ago that it seems to me that the Access 2007 rich text feature does not support: a) full text justification; b) programmatic manipulation. I was hoping that someone might...
8
by: mark_aok | last post by:
Hi all, I have a split database. Both the forms, and the tables are stored on a shared network drive (this is Access 2003). The users use the forms, and the tables on the network drive, there...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.