Access changes my query SQL

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • jeffatncx@gmail.com

    #1

    Access changes my query SQL

    Hi all
    ms Access 2003, SP2.
    I write a SQL statement that unions some other queries and it works
    ok. Then, if I save and close it and open the form that uses the query
    as its data source, I get an error that the form can't find some parts
    of the SQL that was in my query. I open the query again and find that
    Access has changed my SQL, removing some of my code.
    Whats up with that?
    Is there some way to tell Access to leave my SQL code alone, it works
    just fine as I wrote it?

    Thanks
    Jeff
  • Allen Browne

    #2
    Re: Access changes my query SQL

    Access does mess up some SQL statements, especially if you switch to design
    view.

    You may be able to avoid the problem by pasting your SQL statement directly
    into the RecordSource property of the form.

    If that doesn't work, you could use the Open event of the form to assign the
    SQL string to the form's RecordSource.

    --
    Allen Browne - Microsoft MVP. Perth, Western Australia
    Tips for Access users - http://allenbrowne.com/tips.html
    Reply to group, rather than allenbrowne at mvps dot org.

    <jeffatncx@gmai l.comwrote in message
    news:2ce0eea2-0281-46f8-85ec-b8a1aad72449@34 g2000hsh.google groups.com...
    Hi all
    ms Access 2003, SP2.
    I write a SQL statement that unions some other queries and it works
    ok. Then, if I save and close it and open the form that uses the query
    as its data source, I get an error that the form can't find some parts
    of the SQL that was in my query. I open the query again and find that
    Access has changed my SQL, removing some of my code.
    Whats up with that?
    Is there some way to tell Access to leave my SQL code alone, it works
    just fine as I wrote it?
    >
    Thanks
    Jeff

    Comment

    Working...