Your First VBA
Okay, you've never written any VBA code. How do you begin this seemingly daunting task? First of all, Access is very event driven. You need to determine the proper event for the process you want to execute. Obvious examples include the click event of a button, the double-click event of a textbox and the like. Less obvious options are the before and after update events of a form, which occur when you change the data in a bound form, or the current event, which fires when you change records on a bound form.
So you've decided on the appropriate event. In the properties of the form, report or control you've decided on will be an Event tab. On the line for the chosen event, type in "[Event Procedure]" without the quotes, then click on the ellipsis (...) to the far right. It would look like this:
Clicking on the ellipsis will open the VBA editor and start your procedure, with the beginning and ending pre-built for you. That will look like this:
Private Sub cmdFind_Click()
Now you can add your code between those two lines, and Access will run your code when that event occurs. Wasn't that easy?