What's the Difference Between DoCmd.RunSQL and CurrentDb.Execute in Microsoft Access

Поделиться
HTML-код
  • Опубликовано: 5 сен 2024
  • In this Microsoft Access tutorial, I'm going to teach you the difference between DoCmd.RunSQL and CurrentDb.Execute and when you would want to use each.
    Mike from Newcastle, England (a Platinum Member) asks: I've been following your Microsoft Access videos for years, and you used to always use DoCmd.RunSQL in your code. But recently, I've noticed you using CurrentDb.Execute instead. What's the difference between the two, and what should I use?
    Silver members and up get access to an Extended Cut of this video. Members will learn how to trap errors in db.Execute commands with the dbFailOnError parameter. We will also learn how to count how many records were affected with any SQL command by using the RecordsAffected property.
    MEMBERS-ONLY EXTENDED CUT VIDEO:
    • RunSQL vs. Execute EXT...
    BECOME A MEMBER:
    RUclips: / @599cd
    or My Site: 599cd.com/THMe...
    LEARN MORE:
    RunSQL vs Execute: 599cd.com/RunS...
    PREREQUISITES:
    SQL with Access: 599cd.com/SQLw...
    Action Queries: 599cd.com/Acti...
    Intro to VBA: 599cd.com/Intr...
    LINKS:
    Turn Off Warnings: 599cd.com/SetW...
    Value From a Form: 599cd.com/Form...
    Error Handling: 599cd.com/Erro...
    RECOMMENDED COURSES:
    Access SQL Seminars: 599cd.com/SQL
    Access Developer Courses: 599cd.com/Deve...
    RICK'S PICKS:
    No Longer Set: nolongerset.com...
    DEVelopers HUT: devhut.net
    Access Forever: accessforever.org
    Denver Area Access Users Group: daaug.org
    Access User Groups: accessusergroup...
    FREE TEMPLATE DOWNLOADS:
    TechHelp Free Templates: 599cd.com/THFree
    Blank Template: 599cd.com/Blank
    Contact Management: 599cd.com/Cont...
    Order Entry & Invoicing: 599cd.com/Invo...
    More Access Templates: 599cd.com/Acce...
    ADDITIONAL RESOURCES:
    FREE Access Beginner Level 1: 599cd.com/Free1
    How to Use Access in 30 Minutes: 599cd.com/30Mi...
    $1 Access Level 2: 599cd.com/1Dollar
    Donate to my Tip Jar: 599cd.com/TipJar
    Get on my Mailing List: 599cd.com/YTML
    Contact Me: 599cd.com/Contact
    TechHelp: 599cd.com/Tech...
    Consulting Help: 599cd.com/DevNet
    Twitter: / learningaccess
    en.wikipedia.o...
    products.offic...
    microsoft.com/...
    KEYWORDS:
    access 2016, access 2019, access 2021, access 365, microsoft access, ms access, ms access tutorial, #msaccess, #microsoftaccess, #help, #howto, #tutorial, #learn, #lesson, #training, #database, What is the difference between docmd.runsql and currentdb.execute, Execute vs RunSQL, CurrentDb.Execute vs. docmd.runsql, suppress warnings, handle errors, dbFailOnError, RecordsAffected, run-time error 3061, too few parameters expected 1
    QUESTIONS:
    Please feel free to post your questions or comments below. Thanks.

Комментарии • 11

  • @stuartround
    @stuartround Год назад

    I've always used db.execute, but never really looked or understood the difference. This is what I love about your videos, it's great to cover "basics" that I may have completely missed.

  • @FlacoSalsero
    @FlacoSalsero Год назад +1

    Thanks Richard for the great tips. You're kinda like a life coach for Access developers!

  • @xavierbatlle1828
    @xavierbatlle1828 Год назад +1

    Very intetesting topic! I've using recordsets if I wanted to trap errors instead of currentdb. Execute.

  • @Shadow.Dragon
    @Shadow.Dragon Год назад +1

    Richard, thanks for the comparison of RunSQL and Execute!

  • @SavedbyGraceCT
    @SavedbyGraceCT 7 месяцев назад

    Thank you for this explanation!

    • @599CD
      @599CD  7 месяцев назад +1

      You're very welcome!

  •  Год назад +1

    Do you teach how to create DLL for Access?

  • @alializadeh8195
    @alializadeh8195 Год назад +1

    Thanx

  • @kamran133
    @kamran133 4 месяца назад

    Still have not posted ant video about CurrentDb.Execute transaction?

  • @Rogues4Ever
    @Rogues4Ever 8 месяцев назад

    Heard "Es -Que-El" in the first 20 seconds. I'm out.

    • @599CD
      @599CD  8 месяцев назад +1

      See ya! Don't let the door hit you on the way out... :P