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?
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.
@@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!
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.
Excellent presentation and explanation,Thak you very much
You are welcome! Glad you liked it!
You have explained in a very easy way!!!! Thanks
You're welcome! Thanks for watching!
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?
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.
This was extremely helpful and informative,,, Thank you so much ❤
Glad it was helpful! Thanks for watching!
This is so helpful. Thank you
You're welcome! Thanks for watching!
Thank you! Brilliant!
You're welcome! Glad it was helpful!
I would like a macro which will go to a random record rather than just the available presets.
Thanks for the question. You could certainly do that by creating a random number and then going to Range("A" & intRandomNumber).Select
@@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!
Sweet!!!
How do i use it to automatically update my monthly data
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.
Do you have a video on how to create a Macro to open a comment box
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.
👏👏👏👏
Thanks for watching!