LectureWhat’s BASIC?Simple Basic scriptVisual Basic - 1991Slide 5What’s VBA?VBA in ExcelSlide 8VBA in WordVBA for AccessTwo Ways to Make a ButtonAdding a ButtonButton Wizard Step 1Button Wizard Step 2Custom Buttons Adding your own code 1:Custom Buttons Adding your own code 2:Enabling VBA ContentLectureAccess – VBAWhat’s BASIC?•Beginners All-Purpose Symbolic Instruction Code – BASIC•Event driven•Designed in 1964 Dartmouth–For non-computer science students–Students too lazy to learn Fortran and other programming languages•Basis for Gates & Allen success–Altair M.I.T.S. (Micro Instrumentation & Telemetry System)–Start of MicrosoftSimple Basic scriptStandard sample count-to-ten program in old-school BASIC:Visual Basic - 1991•Pioneered by Alan Cooper•Enhanced by Microsoft’s development group•GUI•Stand alone program •Part of Visual StudioVisual Basic - 1991•Used to develop complex applications• Involves visually arranging components or controls on a form•Then specifying attributes and actions of those components•Writing additional lines of code for more functionality.What’s VBA?•Visual Basic for Applications–Embedded w/Program•Custom code to enhance:–Forms–Reports•Can be used for:–Formatting–Security–Saving TimeVBA in Excel•Same controls that are in Access are available in other applications.VBA in Excel•Develops menus, commands and integrated contentVBA in Word•To enhance and add more functionality to WordVBA for Access•Same toolbar you have been using to add formatting to your reports & forms•Control Wizards enable easy use of VBATwo Ways to Make a Button•Use the Wizard for common tasks–Find/Filter/Sort Data–Open a Report/Form/Query–Exit the Program–Etc•Use your own code for…–Just about anything you can imagineAdding a ButtonActivate your Control Toolbar to add a button.Button Wizard Step 1Use the Command Button icon to add a button on your form.Make sure the Control Wizardis turned on.Button Wizard Step 2Tell the Wizard what you want the button to do. Choose from the categories.Pick an icon.Name the button.Position/resize the button how you like.Custom ButtonsAdding your own code 1:•Turn off Wizard or Cancel•Drag in a button and click Right Mouse to Build EventCustom ButtonsAdding your own code 2:•Add or edit yourCustom code in the VBA Editor.Enabling VBA Content•Due to potential security risks, all VBA content must be enabled before it can run:•Click Options•Click Enable Content•Your VBA buttonswon’t run unless you do
View Full Document