Accessing a query through ADODB

hgus393

Registered User.
Local time
Today, 10:47
Joined
Jan 27, 2009
Messages
83
Hi all,

I am trying to access a query which I have done before, but I have come into some trouble. The previous owner of the database had some naming conventions for the queries that is causing me some headaches. Basically I am trying to access the following query Daily information - accumulated

Code:
stSQL = "SELECT * FROM Daily information - accumulated" & ";"

The Sql does not seem to handle the name of the query ie spacing and the "-" sign does anyone know how to get around this trivial issue.
Cheers
Bob
 
Last edited:
A sloppy was is to create a new query that has this query as the underlying source and give it a more meaningful name and refer to this new query in your sql.

David
 
A sloppy was is to create a new query that has this query as the underlying source and give it a more meaningful name and refer to this new query in your sql.

David

Of course!!
I never thought of that :rolleyes:.......
Cheers
Bob
 
When you've finished finding and beating the previous developer for the very dubious gift that is spaces in object names... ;-)
Even in your super query - you'll need to delimit the bad query name (or more to the point - if you use the Access QBE then it will do so for you)
Look in the SQL it generates (a reasonable learning methodology - just don't pay attention to all those brackets in the WHERE clause :-s)

You'll see it's delimited the poor query name - and you could emulate that in your code.
stSQL = "SELECT * FROM [Daily information - accumulated]"

There's nothing wrong with building testing queries - especially as a learning exercise.
But if possible, generally best not to have them cluttering up your application permanently. If you budget stretches to it - some time assigned to removing those spaces could be worth considering?

Cheers.
 
When you've finished finding and beating the previous developer for the very dubious gift that is spaces in object names... ;-)
Even in your super query - you'll need to delimit the bad query name (or more to the point - if you use the Access QBE then it will do so for you)
Look in the SQL it generates (a reasonable learning methodology - just don't pay attention to all those brackets in the WHERE clause :-s)

You'll see it's delimited the poor query name - and you could emulate that in your code.
stSQL = "SELECT * FROM [Daily information - accumulated]"

There's nothing wrong with building testing queries - especially as a learning exercise.
But if possible, generally best not to have them cluttering up your application permanently. If you budget stretches to it - some time assigned to removing those spaces could be worth considering?

Cheers.

:eek:
Yeah I guess I will rethink my quick fix, adding the [ ] brackets surely did the thing!!
Thank you!!
BOB
 

Users who are viewing this thread

Back
Top Bottom