How to Use a Do While Loop in MS Access VBA

แชร์
ฝัง
  • เผยแพร่เมื่อ 8 ม.ค. 2025

ความคิดเห็น • 11

  • @SnackDaddy3x5
    @SnackDaddy3x5 10 หลายเดือนก่อน +1

    Thanks!

  • @RobertTozzi
    @RobertTozzi 2 หลายเดือนก่อน +1

    Great tutorial! Now, what scenarios can I use this in?

    • @seanmackenziedataengineering
      @seanmackenziedataengineering  2 หลายเดือนก่อน +1

      Maybe you have a loop that affects some metric. You could check the metric on each pass. Do while mymetric < 75% - so that your process will continue until the metric is met. Some people even just put Do While myboolean = true, then just run the loop and when some condition is met, the loop sets myboolean to false. Those kind of scenarios. Very useful 🛠

    • @RobertTozzi
      @RobertTozzi 2 หลายเดือนก่อน

      @@seanmackenziedataengineering Makes sense, but I've got a bit of a problem finding a place to implement this. If-then are pretty simple and logical, but I think I need to see more examples of DoWhile in practical use.
      Edit: I figured a basic use of stripping excessive spaces using replace(field.value, “. “,” “)

  • @hailey3901
    @hailey3901 2 ปีที่แล้ว +1

    Hello thank you for good Info!!
    I have a question.
    Is it possible to extract field records that meets some criteria to local array by using For Loop function??

    • @seanmackenziedataengineering
      @seanmackenziedataengineering  2 ปีที่แล้ว +1

      Yes you can. Probably you would be best to use Do Until rst.EOF, then extract the fields you need into an array; however, you can just as easily use For.. Next
      th-cam.com/video/7HckYjH_wg4/w-d-xo.html

    • @hailey3901
      @hailey3901 2 ปีที่แล้ว +1

      @@seanmackenziedataengineering i did it with your video !!! You saved me !! Thank you so much !!🤗

    • @seanmackenziedataengineering
      @seanmackenziedataengineering  2 ปีที่แล้ว +1

      Hey that's awesome, way to go!

  • @satyabanukil779
    @satyabanukil779 ปีที่แล้ว +1

    MS Access tabular forms- How to update data of a column based on data of another column by using loop function. Is there any illustration on that

    • @seanmackenziedataengineering
      @seanmackenziedataengineering  ปีที่แล้ว

      Great question - I'll add it to my list! I generally don't like to move form cursors (selected records) at runtime for more complex data updates. Instead, briefly close the form (or not if it is a Snapshot/read only), perform data updates, then reopen it or refresh it. If you need a loop, you can do it: th-cam.com/video/7HckYjH_wg4/w-d-xo.html