Results 1 to 6 of 6

Thread: Microsoft Access: SQL View - Subquery aliases This is really annoying

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2005
    Posts
    111

    Microsoft Access: SQL View - Subquery aliases This is really annoying

    Hi All

    Please does anyone know how to stop Microsoft Access changing my SQL scripts to use the "]. AS" notation for subquery aliases in the SQL view.

    For example:
    Code:
    SELECT *
    FROM (SELECT [GED Accounts].[EAS Account]
    FROM [GED Accounts])SUBQUERY1;
    becomes,
    Code:
    SELECT *
    FROM [SELECT [GED Accounts].[EAS Account]
    FROM [GED Accounts]]. AS SUBQUERY1;
    The answer would be very much appreciated!


    Thanks

    Pobo

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Microsoft Access: SQL View - Subquery aliases This is really annoying

    Simple, dont switch to Design view as when you switch views it reformats the sql code.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Mar 2005
    Posts
    111

    Re: Microsoft Access: SQL View - Subquery aliases This is really annoying

    RobDog888
    Does that mean you can't stop MS Access reformatting the SQL code. I DO NOT want the SQL script reformatted at any time. Especially, after saving, closing and reopening it.

    RobDog888, I'm sorry to say that your simple solution doesn't resolve my problem at all!


    Does anyone else know if it is possible to stop this automatic reformatting happening?


    Thanks

    Pobo

  4. #4
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Microsoft Access: SQL View - Subquery aliases This is really annoying

    The only way I know is what RobDog888 suggested - only ever look at the query in SQL view. As soon as you open it in another view, Access will 'kindly' change it for you.

    Unfortunately sometimes it will also make changes when you save in SQL view too, but I have never found a solution for that.

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Mar 2005
    Posts
    111

    Re: Microsoft Access: SQL View - Subquery aliases This is really annoying

    Thanks guys.

    Its a shame Microsoft hasn't made this automatic reformatting optional!

  6. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Microsoft Access: SQL View - Subquery aliases This is really annoying

    True. I too have spent time formatting my sql in access only to have it jacked up by viewing in design view. Plus,even if you dont view in design view it will get jacked up again if you do a Compact and Repair.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width