1 / 9

Access VBA Programming for Beginners - Class 3 -

Access VBA Programming for Beginners - Class 3 -. by Patrick Lasu p_lasu@lycos.com. Class 3 - Overview. Static Variables Message box Input Box. Static Variables. A Static variable retains its value between calls to the procedure as long as the form is open.

Download Presentation

Access VBA Programming for Beginners - Class 3 -

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Access VBA Programmingfor Beginners - Class 3 - by Patrick Lasu p_lasu@lycos.com

  2. Class 3 - Overview • Static Variables • Message box • Input Box

  3. Static Variables • A Static variable retains its value between calls to the procedure as long as the form is open. • Syntax: Static varname [As Type] • Very useful for maintaining counters within a local procedure. • Example: Static intCount As Integer

  4. Message Box • A Message box is a handy tool to communicate with the user • Gives information to the user • Accepts user input • There are many pre-set constants that makes the Message box very versatile • Many times there is no need to create a custom Message box

  5. Message Box • Syntax: MsgBox(prompt[, buttons] [, title] [, helpfile, context]) • Prompt = The message text • Buttons = Optional – [OK] is default • Title = Optional – The text in the blue bar • Starting and closing parentheses ( ) are required only if you are receiving user input • Return value is an integer between 1 and 7

  6. Input Box • Are useful if you want to receive input from a user • Not as flexible as Message boxes • Has a very “plain” look • Accepts user input with either [OK] or [Cancel] buttons • Not possible to distinguish between an “empty” user input or selecting [Cancel] • It is possible to “control” it with code – Future Class!!!

  7. Input Box • Syntax: InputBox(prompt[, title] [, default] [, xpos] [, ypos] [, helpfile, context]) • Prompt = Message to the user • Title = Optional - The text in the blue bar • Default = Optional - Default value provided to the user • NOTE: Returns a String value of user input

  8. Review of Class 3 • Static variables are good for keeping count in a local procedure • Message boxes are very versatile • Use them often • Input boxes are useful for user input • Not the greatest, but it works

  9. Next Class… • Variable Conversion • IF Statements • IIF Statements • Select Case Statements

More Related