By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,490 Members | 1,789 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,490 IT Pros & Developers. It's quick & easy.

Building SQL query when table is two words...

P: n/a
I'm attempting to build a query that involves a table called "All
Students".

The query is simply

sqlString = "SELECT * FROM All Students"

but I get "Syntax error in FROM clause" when I try to run it. I assume
this is because my table is two words. How do I get Access to recognize
it?

Thanks,
Kevin

Nov 14 '05 #1
Share this Question
Share on Google+
16 Replies


P: n/a
Square brackets i.e.

sqlString = "SELECT * FROM [All Students]"
--
Terry Kreft

<au******@quasika.net> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
I'm attempting to build a query that involves a table called "All
Students".

The query is simply

sqlString = "SELECT * FROM All Students"

but I get "Syntax error in FROM clause" when I try to run it. I assume
this is because my table is two words. How do I get Access to recognize
it?

Thanks,
Kevin

Nov 14 '05 #2

P: n/a
Br
Terry Kreft wrote:
Square brackets i.e.

sqlString = "SELECT * FROM [All Students]"
IMO good practice to always use square brackets around field/tables
names.
<au******@quasika.net> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
I'm attempting to build a query that involves a table called "All
Students".

The query is simply

sqlString = "SELECT * FROM All Students"

but I get "Syntax error in FROM clause" when I try to run it. I
assume this is because my table is two words. How do I get Access to
recognize it?

Thanks,
Kevin


--
regards,

Bradley

A Christian Response
http://www.pastornet.net.au/response
Nov 15 '05 #3

P: n/a
I would hold good practice to be to establish a naming convention you stick
to ; in my case this would mainly be:-
a) not use spaces in table or field names.
b) stick to names which are valid on all the platforms I am liable to
use.
c) use lower case for names with underscore separators for readability.

If your convention involves using square brackets at all times that's fine
but it isn't necessarily good practice.
--
Terry Kreft

"Br@dley" <br**@usenet.org> wrote in message
news:oZ******************@news-server.bigpond.net.au...
Terry Kreft wrote:
Square brackets i.e.

sqlString = "SELECT * FROM [All Students]"


IMO good practice to always use square brackets around field/tables names.
<au******@quasika.net> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
I'm attempting to build a query that involves a table called "All
Students". <SNIP> Thanks,
Kevin


--
regards,

Bradley

A Christian Response
http://www.pastornet.net.au/response

Nov 15 '05 #4

P: n/a
Br
Terry Kreft wrote:
I would hold good practice to be to establish a naming convention you
stick to ; in my case this would mainly be:-
a) not use spaces in table or field names.
b) stick to names which are valid on all the platforms I am liable
to use.
c) use lower case for names with underscore separators for
readability.
If your convention involves using square brackets at all times that's
fine but it isn't necessarily good practice.
As I said, my opinion only.

While I agree with the above (I never use spaces) you are assuming the
developer is the one creating the table/etc whereas in real life
developers are often fixing up someone else's work and don't have the
luxury of renaming all the database objects to conform to their personal
standards.
"Br@dley" <br**@usenet.org> wrote in message
news:oZ******************@news-server.bigpond.net.au...
Terry Kreft wrote:
Square brackets i.e.

sqlString = "SELECT * FROM [All Students]"


IMO good practice to always use square brackets around field/tables
names.
<au******@quasika.net> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
I'm attempting to build a query that involves a table called "All
Students". <SNIP> Thanks,
Kevin


--
regards,

Bradley

A Christian Response
http://www.pastornet.net.au/response
Nov 15 '05 #5

P: n/a
I'm not assuming anything. I'm stating a short version of my own practices.

If you had spent as much time as I have fixing other peoples code you would
probably realise why it is better to espouse real good practices in code
writing/database creation rather than ones which would be irrelevant if the
work had been done properly in the first place.
--
Terry Kreft

"Br@dley" <br**@usenet.org> wrote in message
news:mK******************@news-server.bigpond.net.au...
Terry Kreft wrote:
I would hold good practice to be to establish a naming convention you
stick to ; in my case this would mainly be:-
a) not use spaces in table or field names.
b) stick to names which are valid on all the platforms I am liable
to use.
c) use lower case for names with underscore separators for
readability.
If your convention involves using square brackets at all times that's
fine but it isn't necessarily good practice.


As I said, my opinion only.

While I agree with the above (I never use spaces) you are assuming the
developer is the one creating the table/etc whereas in real life
developers are often fixing up someone else's work and don't have the
luxury of renaming all the database objects to conform to their personal
standards.
"Br@dley" <br**@usenet.org> wrote in message
news:oZ******************@news-server.bigpond.net.au...
Terry Kreft wrote:
Square brackets i.e.

sqlString = "SELECT * FROM [All Students]"

IMO good practice to always use square brackets around field/tables
names.
<au******@quasika.net> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
> I'm attempting to build a query that involves a table called "All
> Students".

<SNIP>
> Thanks,
> Kevin


--
regards,

Bradley

A Christian Response
http://www.pastornet.net.au/response

Nov 15 '05 #6

P: n/a
Br
Terry Kreft wrote:
I'm not assuming anything. I'm stating a short version of my own
practices.
If you had spent as much time as I have fixing other peoples code
you...
Another assumption? :)

I've 11+ years experience with Access development. More than enough to
have an idea of what I'm talking about.
would probably realise why it is better to espouse real good
practices in code writing/database creation rather than ones which
would be irrelevant if the work had been done properly in the first
place.

As I said, I agree with the implementation of standards when developing
a database.

However, I stand by my initial point. Most real world jobs that I have
been involved in no-one is there to "espouse" good practice to. The
original 'developer' (I use the term loosely as most aren't real
developers) is long gone and you've been called in to add reporting or
something. Their is usually a tight budget involved that does not allow
for the luxury of redesigning the application to conform to good
practice.
"Br@dley" <br**@usenet.org> wrote in message
news:mK******************@news-server.bigpond.net.au...
Terry Kreft wrote:
I would hold good practice to be to establish a naming convention
you stick to ; in my case this would mainly be:-
a) not use spaces in table or field names.
b) stick to names which are valid on all the platforms I am
liable to use.
c) use lower case for names with underscore separators for
readability.
If your convention involves using square brackets at all times
that's fine but it isn't necessarily good practice.
As I said, my opinion only.

While I agree with the above (I never use spaces) you are assuming
the developer is the one creating the table/etc whereas in real life
developers are often fixing up someone else's work and don't have the
luxury of renaming all the database objects to conform to their
personal standards.
"Br@dley" <br**@usenet.org> wrote in message
news:oZ******************@news-server.bigpond.net.au...
Terry Kreft wrote:
> Square brackets i.e.
>
> sqlString = "SELECT * FROM [All Students]"

IMO good practice to always use square brackets around field/tables
names.
> <au******@quasika.net> wrote in message
> news:11**********************@g49g2000cwa.googlegr oups.com...
>> I'm attempting to build a query that involves a table called "All
>> Students".
<SNIP>
>> Thanks,
>> Kevin


--
regards,

Bradley

A Christian Response
http://www.pastornet.net.au/response


--
regards,

Bradley

A Christian Response
http://www.pastornet.net.au/response
Nov 16 '05 #7

P: n/a

OK, you seem intent on insisting I said something that I didn't so
discussing the issue with you seems irrelevant.

BYW 11+ years, means to me you are just reaching puberty in your programming
life, so that maybe explains something I hadn't taken into account <g>.

--
Terry Kreft

"Br@dley" <br**@usenet.org> wrote in message
news:Vs******************@news-server.bigpond.net.au...
Terry Kreft wrote:
I'm not assuming anything. I'm stating a short version of my own
practices.
If you had spent as much time as I have fixing other peoples code you...


Another assumption? :)

I've 11+ years experience with Access development. More than enough to
have an idea of what I'm talking about.
would probably realise why it is better to espouse real good
practices in code writing/database creation rather than ones which
would be irrelevant if the work had been done properly in the first
place.

As I said, I agree with the implementation of standards when developing a
database.

However, I stand by my initial point. Most real world jobs that I have
been involved in no-one is there to "espouse" good practice to. The
original 'developer' (I use the term loosely as most aren't real
developers) is long gone and you've been called in to add reporting or
something. Their is usually a tight budget involved that does not allow
for the luxury of redesigning the application to conform to good practice.
"Br@dley" <br**@usenet.org> wrote in message
news:mK******************@news-server.bigpond.net.au...
Terry Kreft wrote:
I would hold good practice to be to establish a naming convention
you stick to ; in my case this would mainly be:-
a) not use spaces in table or field names.
b) stick to names which are valid on all the platforms I am
liable to use.
c) use lower case for names with underscore separators for
readability.
If your convention involves using square brackets at all times
that's fine but it isn't necessarily good practice. As I said, my opinion only.

While I agree with the above (I never use spaces) you are assuming
the developer is the one creating the table/etc whereas in real life
developers are often fixing up someone else's work and don't have the
luxury of renaming all the database objects to conform to their
personal standards.

"Br@dley" <br**@usenet.org> wrote in message
news:oZ******************@news-server.bigpond.net.au...
> Terry Kreft wrote:
>> Square brackets i.e.
>>
>> sqlString = "SELECT * FROM [All Students]"
>
> IMO good practice to always use square brackets around field/tables
> names.
>> <au******@quasika.net> wrote in message
>> news:11**********************@g49g2000cwa.googlegr oups.com...
>>> I'm attempting to build a query that involves a table called "All
>>> Students".
<SNIP>
>>> Thanks,
>>> Kevin

--
regards,

Bradley

A Christian Response
http://www.pastornet.net.au/response


--
regards,

Bradley

A Christian Response
http://www.pastornet.net.au/response

Nov 16 '05 #8

P: n/a
"Br@dley" <br**@usenet.org> wrote in
news:Vs******************@news-server.bigpond.net.au:
However, I stand by my initial point. Most real world jobs that I
have been involved in no-one is there to "espouse" good practice
to. The original 'developer' (I use the term loosely as most
aren't real developers) is long gone and you've been called in to
add reporting or something. Their is usually a tight budget
involved that does not allow for the luxury of redesigning the
application to conform to good practice.


On any projects where I'm brought in to add something to the work of
another "developer," part of my estimate will include a cleanup
process, which is necessary before I'll agree to take over and
support any alterations to the application. This is a non-negotiable
part of the project (and needs to happn only once).

I can't waste my time repeatedly working around bad naming
conventions, and I refuse to do so. And the client pays me to fix
the things their previous developer did wrong. If they don't want to
pay me to do that, they can hire someone else to do the job.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 17 '05 #9

P: n/a
Br
David W. Fenton wrote:
"Br@dley" <br**@usenet.org> wrote in
news:Vs******************@news-server.bigpond.net.au: <>
.... part of my estimate will include a cleanup
process, which is necessary before I'll agree to take over and
support any alterations to the application. This is a non-negotiable
part of the project (and needs to happn only once).
<>
If they don't want to
pay me to do that, they can hire someone else to do the job.


It's nice if you can afford that luxury.
--
regards,

Bradley

A Christian Response
http://www.pastornet.net.au/response
Nov 17 '05 #10

P: n/a
"Br@dley" <br**@usenet.org> wrote in
news:zL*******************@news-server.bigpond.net.au:
David W. Fenton wrote:
"Br@dley" <br**@usenet.org> wrote in
news:Vs******************@news-server.bigpond.net.au:

<>
.... part of my estimate will include a cleanup
process, which is necessary before I'll agree to take over and
support any alterations to the application. This is a
non-negotiable part of the project (and needs to happn only
once).


<>
If they don't want to
pay me to do that, they can hire someone else to do the job.


It's nice if you can afford that luxury.


It's not a luxury. I won't punish myself by taking projects where
the clients aren't interested in doing things right. I'm *saving*
them money in the long run, and saving myself gray hairs (or any
other developer who comes along after me).

Most clients can't determine what's required or not. I just make the
reworking of the app to meet my standards a required part of the
project, not even suggesting that it is in any way optional.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 17 '05 #11

P: n/a
Br
David W. Fenton wrote:
"Br@dley" <br**@usenet.org> wrote in
news:zL*******************@news-server.bigpond.net.au:
David W. Fenton wrote:
"Br@dley" <br**@usenet.org> wrote in
news:Vs******************@news-server.bigpond.net.au: <>
.... part of my estimate will include a cleanup
process, which is necessary before I'll agree to take over and
support any alterations to the application. This is a
non-negotiable part of the project (and needs to happn only
once).


<>
If they don't want to
pay me to do that, they can hire someone else to do the job.


It's nice if you can afford that luxury.

It's not a luxury. I won't punish myself by taking projects where
the clients aren't interested in doing things right. I'm *saving*
them money in the long run, and saving myself gray hairs (or any
other developer who comes along after me).
Sure, but "beggars can't be choosers" all the time in business.
Most clients can't determine what's required or not.
Most know what they want and usually have tight budgets/red tape.
I just make the
reworking of the app to meet my standards a required part of the
project, not even suggesting that it is in any way optional.


I'd love to be able to do that all the time but it just isn't going to
happen :)
--
regards,

Bradley

A Christian Response
http://www.pastornet.net.au/response
Nov 18 '05 #12

P: n/a
"Br@dley" <br**@usenet.org> wrote in
news:6l******************@news-server.bigpond.net.au:
David W. Fenton wrote:
"Br@dley" <br**@usenet.org> wrote in
news:zL*******************@news-server.bigpond.net.au:
David W. Fenton wrote:
"Br@dley" <br**@usenet.org> wrote in
news:Vs******************@news-server.bigpond.net.au:
<>

.... part of my estimate will include a cleanup
process, which is necessary before I'll agree to take over and
support any alterations to the application. This is a
non-negotiable part of the project (and needs to happn only
once).

<>

If they don't want to
pay me to do that, they can hire someone else to do the job.

It's nice if you can afford that luxury.
It's not a luxury. I won't punish myself by taking projects

where the clients aren't interested in doing things right. I'm *saving* them money in the long run, and saving myself gray hairs (or any
other developer who comes along after me).


Sure, but "beggars can't be choosers" all the time in business.


Well, these days, I'm something of a beggar, but it's not because
of
these kinds of things that my business is slow -- it's because
there
just isn't work out there, and the clients with work aren't paying
quickly.
Most clients can't determine what's required or not.


Most know what they want and usually have tight budgets/red tape.


If I say I cannot do B until I've done A, they have to pay for A.

Or, I could add the price of A into B and not include it in the
estimate at all.

But I'd rather be honest.

And there's also the advantage to be gotten from convincing them
that I'm concerned with long-term maintainability of their
application, that the money invested pays off in the long run by
making it easier to maintain and extend the application in the
future.

If I didn't actually believe that, I certainly wouldn't spend the
time on it.
I just make the
reworking of the app to meet my standards a required part of the
project, not even suggesting that it is in any way optional.


I'd love to be able to do that all the time but it just isn't
going to happen :)


Have you tried it? I don't find clients to be that unreasonable if
you take the time to explain to them why what you're proposing is
needed and why it benefits them in the long run.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 18 '05 #13

P: n/a
Br
David W. Fenton wrote:
"Br@dley" <br**@usenet.org> wrote in
news:6l******************@news-server.bigpond.net.au:
David W. Fenton wrote:
"Br@dley" <br**@usenet.org> wrote in
news:zL*******************@news-server.bigpond.net.au:

David W. Fenton wrote:
> "Br@dley" <br**@usenet.org> wrote in
> news:Vs******************@news-server.bigpond.net.au:
<>

> .... part of my estimate will include a cleanup
> process, which is necessary before I'll agree to take over and
> support any alterations to the application. This is a
> non-negotiable part of the project (and needs to happn only
> once).

<>

> If they don't want to
> pay me to do that, they can hire someone else to do the job.

It's nice if you can afford that luxury.

It's not a luxury. I won't punish myself by taking projects where
the clients aren't interested in doing things right. I'm *saving*
them money in the long run, and saving myself gray hairs (or any
other developer who comes along after me).


Sure, but "beggars can't be choosers" all the time in business.


Well, these days, I'm something of a beggar, but it's not because
of
these kinds of things that my business is slow -- it's because
there
just isn't work out there, and the clients with work aren't paying
quickly.
Most clients can't determine what's required or not.


Most know what they want and usually have tight budgets/red tape.


If I say I cannot do B until I've done A, they have to pay for A.

Or, I could add the price of A into B and not include it in the
estimate at all.

But I'd rather be honest.

And there's also the advantage to be gotten from convincing them
that I'm concerned with long-term maintainability of their
application, that the money invested pays off in the long run by
making it easier to maintain and extend the application in the
future.

If I didn't actually believe that, I certainly wouldn't spend the
time on it.
I just make the
reworking of the app to meet my standards a required part of the
project, not even suggesting that it is in any way optional.


I'd love to be able to do that all the time but it just isn't
going to happen :)


Have you tried it? I don't find clients to be that unreasonable if
you take the time to explain to them why what you're proposing is
needed and why it benefits them in the long run.


Yes, of course. I'm not saying I've never had clients who are willing to
put in the resources to properly fix the database (you gotta love the
ones who say "sure go and do whatever you think needs to be done"). I'm
just stating that there are also those that don't. Typically you list
out everything and they tend to wittle out the things they don't won't
regardless of how much you protest. If I choose not to do it they will
go to another developer whose quote is lower. Sometimes,hopefully,
starting this way will lead to a longer term relationship where they
will feel more comfortable putting more resources into redesigning badly
build apps.
--
regards,

Bradley

A Christian Response
http://www.pastornet.net.au/response
Nov 18 '05 #14

P: n/a
When I read this I think I should give thanks for never having had to
deal with such situations or people.
But give thanks to whom: My Mom? Random Chance? Lauren Bacall? Mr Getz?

You use Square Brackets and you think this is Truth.
Then you find there are other solutions:

SELECT * FROM All_Students
SELECT * FROM `All Students`

And you wonder ....

Nov 18 '05 #15

P: n/a
lylefair wrote:
When I read this I think I should give thanks for never having had to
deal with such situations or people.
But give thanks to whom: My Mom? Random Chance? Lauren Bacall? Mr Getz?
Fortune, of course :-).

You use Square Brackets and you think this is Truth.
Then you find there are other solutions:
Horatio, you're dumbing down Shakespeare.

SELECT * FROM All_Students
SELECT * FROM `All Students`

And you wonder ....


James A. Fortune

There is more in the world than you have dreamt of in all of your
philosophies, Horatio.
-- Hamlet Act1

On a midnight train to Beverly, MA:

Overheard from an elderly passenger going to Salem:
This astrology stuff really works.
Me:
So do you believe that God put messages in the stars for us to read?
Passenger:
I don't believe in God!

(heads turn toward her)

Nov 18 '05 #16

P: n/a
Br
lylefair wrote:
When I read this I think I should give thanks for never having had to
deal with such situations or people.
But give thanks to whom: My Mom? Random Chance? Lauren Bacall? Mr
Getz?

You use Square Brackets and you think this is Truth.


Truth? No, IMO it's just an easy way to make all objects names work in
code when spaces have been used and it also helps the name stand out
when reading the code. As with many things in Access there is 'more than
one way to skin the cat'.

<>
--
regards,

Bradley

A Christian Response
http://www.pastornet.net.au/response
Nov 19 '05 #17

This discussion thread is closed

Replies have been disabled for this discussion.