Getting Started with MS Access Visual Basic for Applications - VBA Code-Behind and Modules

Поділитися
Вставка
  • Опубліковано 9 лис 2024

КОМЕНТАРІ • 24

  • @khabathawrami
    @khabathawrami 2 роки тому +4

    Your videos about Ms Access and VBA are great .. Thank you

  • @mohamedAccurate
    @mohamedAccurate Рік тому +1

    Thanks for the great effort. I need to paste a value into a selection rows in the table through VBA Code

    • @seanmackenziedataengineering
      @seanmackenziedataengineering  Рік тому

      Thanks! You could try just doing an update query:
      ua-cam.com/video/9CBxtBylSvE/v-deo.html
      You can use the VBA in this video that shows how to update/add a value via VBA code:
      ua-cam.com/video/qv-xr2zBCDA/v-deo.html
      In the line rst.Add, use rst.Edit instead. Make sure you put an if statement in there too (if you need it) ie.
      if MyType = 'ABC' Then
      rst.Edit
      rst!MyField = SomeValue
      rst.Update
      End if

  • @davegoodo3603
    @davegoodo3603 9 місяців тому +1

    Hi Sean, I'm taking a walk through this playlist. I have VBA experience in Access but I want to do an intro to see if there are gaps in my knowledge. I hope to do the Intermediate and Advanced as well so that I'm really prepared for a project I'm involved in. I've checked out some of your videos and I feel confident that you will have the info I'm looking for. Thanks as always, on with the show!
    I watched this intro video Sean, you do set a fairly steep learning curve. The focus was mainly on visibility and getting the difference between Public & Private and how that relates to forms and modules. You didn't mention your prefix "p" for public variables, if I was brand new I'd wonder what that was. Anyway, I'm sure an intro to anything is going to be challenging because there's so many bases to cover. I don't want to sound too critical, your relaxed style always makes the content easy to follow even if at times it can be distracting. I'm going to continue with the next in the series. Thanks Sean.

    • @seanmackenziedataengineering
      @seanmackenziedataengineering  9 місяців тому

      Hey Dave, many thanks and I'm always interested in constructive feedback. I concede that my methods can be a bit jarring. Generally I try to avoid providing an encyclopedic, classroom style of learning that you can find everywhere and instead focus on breakthroughs. If I am an analyst working on my prototype, what can I do right now? What are the levers I can apply? In broad strokes, how does it all come together? Will this technique even get me where I need to go? How can I go from A to B without going into the minutiae of why (right now)? My style comes from decades of office and shop-floor mentoring of professionals who are already mid-stride in any task. I provide the breakthroughs in situations where I know smart, tech-savvy learners will actively research documentation for detail anyway. Again, I always appreciate the feedback! Since I made this video I am trying to make the lessons more approachable while still focusing on breakthroughs.

    • @davegoodo3603
      @davegoodo3603 9 місяців тому

      @@seanmackenziedataengineering Hi Sean, Understood. I now know more about your presentation style, thank you. Thanks for getting back to me, I really appreciate that.

  • @jamesmartinez9069
    @jamesmartinez9069 2 роки тому +3

    Magnifica enseñanza, diez mil gracias señor Sean

  • @matthewb5235
    @matthewb5235 9 місяців тому +1

    Hi Sean. I appreciate your videos, so thanks first of for making them available. That's getting started, but where would you suggest going to to find a course in VBA? Any thoughts? Udemy? CodeAcademy? A college online course? Are you aware of any you like? There are so many. And I should perhaps add, a course that you provide but I think you might not be focused of the basics so to speak, but coding techniques for more experienced Access users.

    • @seanmackenziedataengineering
      @seanmackenziedataengineering  9 місяців тому +1

      Great question - there are lots of good resources out there. I have found that people generally do better if they pick some kind of project to do, then learn concepts, researching as they go here on YT, stackoverflow, and other programming sites. VBA is great, but you should also learn database concepts early in your study. Soooo many programmers learn how to program in (insert language here) and work for years, then are blindsided on the first time they have to actually design a database or data repository for a project. Pay attention to your data concepts as you go! Any course from a reputable source will be good to get you started with VBA; just complement it with a data project of your own.

  • @charleskent6795
    @charleskent6795 Рік тому +1

    This is a excellenf intro to VBA. One question: at 18.49, what did you do to "run the function" and open the OUR_MODULE window?

    • @seanmackenziedataengineering
      @seanmackenziedataengineering  Рік тому

      Thanks! At 16:55 I go to the Create ribbon and then Module. This creates a general module that by default has Sub and Function code blocks that you can use throughout your app. Unlike the button click event code we created earlier, you can call them from code in your form modules' click events etc. This allows you to use one function many times ("code re-use") instead of copy-pasting code over and over. This makes your code more efficient and easier to maintain.

    • @charleskent6795
      @charleskent6795 Рік тому

      Thank you for your speedy respose! . I understood that. My question is more about navigation. At just before 18.49, running your video at 1 quarter speed I saw your mouse movements, hoping to see what you pressed to make the module code window pop up, but it suddenly popped up without me seeing what you did. I am completely new to access, and learning it to wean myself off Visual FoxPro.

    • @seanmackenziedataengineering
      @seanmackenziedataengineering  Рік тому

      @@charleskent6795 Ah ok! I had the code window minimized and just brought it back to focus. However, you can use Ctrl+g to bring the Immediate Window to view which in turn brings your code editor up as well. I ran it by putting the cursor within the code lines of the Sub and then pressing play on the toolbar. This only works for Subs, which you can also run by simply typing their name in the immediate window and pressing enter. If your sub has arguments then you should just use the immediate window. To run a function, put ? just before your function name and with () or arguments to execute that function. You can also use the Immediate Window to get a value from your open form or to run an expression for basically anything. Ex. ?Forms!MyForm!txtMyTextForm will return that value. Good for finding excess spaces and funky entries.

    • @charleskent6795
      @charleskent6795 Рік тому

      Brilliant. Thank you so much. Things like that take ages to find out and are really useful.

  • @garcimat
    @garcimat 2 роки тому +1

    Your videos are the best

  • @finvictho8484
    @finvictho8484 8 місяців тому +1

    Can I set Access talk off (no any prompts from access )while using Querry update function.

    • @seanmackenziedataengineering
      @seanmackenziedataengineering  8 місяців тому +1

      DoCmd.SetWarnings False
      DoCmd.RunSQL "Update MyTable Set Field1 = Forms!MyForm!txtMyField Where ID = 123;"
      DoCmd.SetWarnings True

  • @krishnakuraku6853
    @krishnakuraku6853 2 роки тому +1

    Can you please do a video on how to write and execute stored procedure or function in python..?