From: Marshall Barton on
Jeff Freilich wrote:
>I know that you cannot actually have a query with an SQL statement -
>but what I am trying to emulate it if you open a query in the query
>editor = go to SQL view and delete all the SQL - when you go back to
>the Query Editor you get an empty Editor (and then if you go back to
>the SQL view you see: "SELECT;"
>
>Is that possible to emulate or is that just a feature/function of
>Acces that puts the "SELECT;" back in to what appears to be an empty
>SQL statement?


Have you tried to save that? It clearly is not a valid SQL
statement (thus not a valid query) and you get the same
reserved word error message.

That leads me to the conclusion that you are trying to
emulate something that Access doesn't do and can not allow.

--
Marsh
MVP [MS Access]
From: Banana on
Jeff Freilich wrote:
> Hello and thanks for the reply
>
> I know that you cannot actually have a query with an SQL statement -
> but what I am trying to emulate it if you open a query in the query
> editor = go to SQL view and delete all the SQL - when you go back to
> the Query Editor you get an empty Editor (and then if you go back to
> the SQL view you see: "SELECT;"
>
> Is that possible to emulate or is that just a feature/function of
> Acces that puts the "SELECT;" back in to what appears to be an empty
> SQL statement?
>
> Thanks
>
> Jeff

This?

http://www.accessruncommand.com/codeex/184.htm
From: Douglas J. Steele on
As Marshall points out, you seem to be wanting to do something Access
doesn't support.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Jeff Freilich" <jeffto29(a)hotmail.com> wrote in message
news:4f745cf1-551e-4786-bb30-8123cc3a592c(a)f20g2000vbl.googlegroups.com...
> Sorry Doug
>
> I was responding to the previous post - who said you cant have an
> "Empty" SQL statement (I missed the word empty)
>
> WHat I am trying to do is this
>
> I have a query in my database called "EditQuery" - this is really just
> a placeholder query - I have a table that stores various SQL
> statements that the Admin users can modify/edit/run as needed. I can
> easily pass the SQL statement from the table into the
> "EditQuery" (once they finish editing the query they will save it and
> then I have a process which allows them to save the SQL statement from
> "EditQuery" back in to the table.
>
> But where I am stuck is if I want to allow the user to "Add" a new
> query - I want to change the "EditQuery" SQL statement to nothing so
> that it opens up a blank Query Editory - as if you selected New Query.
>
> Can you pass a null or empty value to QueryDef("EditQuery")? Or is
> there a better way to do what I am attempting to do?
>
> I hope I explained it better this time - if not please let me know -
> thanks for your assistance
>
> Jeff


From: Jeff Freilich on
Thanks to everyone for their reply

Yes I can save a query that has nothing in it.

You canot run the query - you get the message "Query Must have at
least one destination field" - but you can edit it and when you do you
get an Empty Query Editor

But what I am getting is that this must be a build in featuer of how
access handles queries - and that you cannot in fact pass an empty
value to the Querydefs SQL statement.

And I can't even simply add a table to the SQL statement: "SELECT FROM
tblOLRMain;
I guess I have to pass at least one field to the SQL statement:
"SELECT tblOLRMain.OLID FROM tblOLRMain;"

Thanks,

Jeff
From: Douglas J. Steele on
You could always use

"SELECT * FROM tblOLRMain;"


--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Jeff Freilich" <jeffto29(a)hotmail.com> wrote in message
news:74c933fa-26cc-4216-9a96-3dc6e1774f5c(a)33g2000vbe.googlegroups.com...
> Thanks to everyone for their reply
>
> Yes I can save a query that has nothing in it.
>
> You canot run the query - you get the message "Query Must have at
> least one destination field" - but you can edit it and when you do you
> get an Empty Query Editor
>
> But what I am getting is that this must be a build in featuer of how
> access handles queries - and that you cannot in fact pass an empty
> value to the Querydefs SQL statement.
>
> And I can't even simply add a table to the SQL statement: "SELECT FROM
> tblOLRMain;
> I guess I have to pass at least one field to the SQL statement:
> "SELECT tblOLRMain.OLID FROM tblOLRMain;"
>
> Thanks,
>
> Jeff