How to Make a Macro in Microsoft Access

Поділитися
Вставка
  • Опубліковано 14 січ 2025

КОМЕНТАРІ • 22

  • @SanVibonCompany
    @SanVibonCompany 9 місяців тому +3

    You have explained in a very easy way!!!! Thanks

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

      You're welcome! Thanks for watching!

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

    Excellent presentation and explanation,Thak you very much

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

    Thanks for the video.. my requirement is to automate this macro execution.. how do I schedule this access macro using Windows Scheduler or something like that?

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

      Great question! You could create a macro called autoexec and then use a windows task to open that database (autoexec macro runs automatically when the database is first opened). Make sure you close the database at the end of the autoexec. If that doesn't work, try opening a form with the autoexec macro and then putting VBA code in OnOpen even of the form.

  • @outdatedgear5036
    @outdatedgear5036 3 місяці тому

    This is so helpful. Thank you

    • @MyExcelOnline
      @MyExcelOnline  3 місяці тому

      You're welcome! Thanks for watching!

  • @qabasalkharusi
    @qabasalkharusi Місяць тому

    This was extremely helpful and informative,,, Thank you so much ❤

    • @MyExcelOnline
      @MyExcelOnline  Місяць тому

      Glad it was helpful! Thanks for watching!

  • @firstlast5350
    @firstlast5350 5 місяців тому +1

    I would like a macro which will go to a random record rather than just the available presets.

    • @MyExcelOnline
      @MyExcelOnline  5 місяців тому +1

      Thanks for the question. You could certainly do that by creating a random number and then going to Range("A" & intRandomNumber).Select

    • @firstlast5350
      @firstlast5350 4 місяці тому +1

      @@MyExcelOnline Thanks for reply. Since question, I added button in form design view and added code to the build event you go to when right clicking on it:
      Private Sub Command4_Click()
      Dim rs As Recordset
      Dim recordCount As Long
      Dim randomRecord As Long
      ' Open the form's recordset
      Set rs = Me.RecordsetClone
      ' Move to the last record to get the count
      rs.MoveLast
      recordCount = rs.recordCount
      Randomize
      rs.MoveFirst
      ' Generate a random record number
      randomRecord = CLng((recordCount) * Rnd)

      ' Move to the randomly selected record
      rs.Move randomRecord
      Me.Bookmark = rs.Bookmark
      ' Clean up
      rs.Close
      Set rs = Nothing
      End Sub
      Code courtesy of chatgpt!

    • @MyExcelOnline
      @MyExcelOnline  4 місяці тому +1

      Sweet!!!

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

    👏👏👏👏

  • @yeabuca
    @yeabuca 4 місяці тому

    Thank you! Brilliant!

    • @MyExcelOnline
      @MyExcelOnline  4 місяці тому

      You're welcome! Glad it was helpful!

  • @Gamer171-y1w
    @Gamer171-y1w 2 місяці тому

    How do i use it to automatically update my monthly data

    • @MyExcelOnline
      @MyExcelOnline  2 місяці тому

      Do you open the database regularly? If so, you could have the macro run each time the database opens. Eventually the month would update that way.

  • @AngelaBrown-xs4kd
    @AngelaBrown-xs4kd 2 роки тому

    Do you have a video on how to create a Macro to open a comment box

    • @MyExcelOnline
      @MyExcelOnline  2 роки тому

      Thanks for the question. We do not have one yet. Are you opening a form as the comment box? If so, you can use the OpenForm option in a macro to open that form for the user.