Call Us Now - 7290946874 / 7290946875 / 7290946876

[Microsoft access 2013 vba pdf free

Looking for:

Microsoft access 2013 vba pdf free

Click here to Download

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Description : This document has been developed to help you learn more about several useful features in Access such as creating a Form.

Introduction to Microsoft Access Description : Download an introduction to the Microsoft Access interface and covers the various aspects of database creation and management in Access Access Reports and Queries.

Description : This document has been developed to help you learn more about several useful features in Access including printing, applying queries, and importing Excel files.

Microsoft Access Level 1. Description : Download free Microsoft Access level 1, course tutorial training, This document, Level 1, has been developed to introduce you to Microsoft Access. Introduction to Access Access Database Design. Disable all macros except digitally signed macros Macros are disabled, and security alerts appear if there are unsigned macros present.

However, if the macro is digitally signed by a trusted publisher, the macro just runs. If the macro is signed by a publisher you haven’t trusted yet, you are given the opportunity to enable the signed macro and trust the publisher. Enable all macros not recommended, potentially dangerous code can run All macros run without confirmation. This setting makes your computer vulnerable to malicious code. Excel also has a checkbox for Enable Excel 4. If you select this checkbox all of the above settings for VBA macros will also apply to Excel 4.

If this checkbox is not selected XLM macros are disabled without notification. This security option is for code written to automate a Microsoft program and manipulate the VBA environment and object model. It is a per-user and per-application setting, and denies access by default, hindering unauthorized programs from building harmful self-replicating code.

For automation clients to access the VBA object model, the user running the code must grant access. In fact, the automation of repetitive tasks is one of the most common uses of VBA in Office.

Beyond the power of scripting VBA to accelerate every-day tasks, you can use VBA to add new functionality to Office applications or to prompt and interact with the user of your documents in ways that are specific to your business needs. For example, you could write some VBA code that displays a pop up message that reminds users to save a document to a particular network drive the first time they try to save it.

This article explores some of the primary reasons to leverage the power of VBA programming. It explores the VBA language and the out-of-the-box tools that you can use to work with your solutions. Finally, it includes some tips and ways to avoid some common programming frustrations and missteps. Interested in developing solutions that extend the Office experience across multiple platforms? Check out the new Office Add-ins model. VBA is effective and efficient when it comes to repetitive solutions to formatting or correction problems.

For example, have you ever changed the style of the paragraph at the top of each page in Word? Have you ever had to reformat multiple tables that were pasted from Excel into a Word document or an Outlook email?

Have you ever had to make the same change in multiple Outlook contacts? If you have a change that you have to make more than ten or twenty times, it may be worth automating it with VBA. If it is a change that you have to do hundreds of times, it certainly is worth considering.

Almost any formatting or editing change that you can do by hand, can be done in VBA. There are times when you want to encourage or compel users to interact with the Office application or document in a particular way that is not part of the standard application. For example, you might want to prompt users to take some particular action when they open, save, or print a document. Do you need to copy all of your contacts from Outlook to Word and then format them in some particular way? Or, do you need to move data from Excel to a set of PowerPoint slides?

Sometimes simple copy and paste does not do what you want it to do, or it is too slow. Use VBA programming to interact with the details of two or more Office applications at the same time and then modify the content in one application based on the content in another. VBA programming is a powerful solution, but it is not always the optimal approach. Sometimes it makes sense to use other ways to achieve your aims.

The critical question to ask is whether there is an easier way. Before you begin a VBA project, consider the built-in tools and standard functionalities. For example, if you have a time-consuming editing or layout task, consider using styles or accelerator keys to solve the problem. Can you create a new document with the correct format or template, and then copy the content into that new document?

Office applications are powerful; the solution that you need may already be there. Take some time to learn more about Office before you jump into programming.

Programming requires focus and can be unpredictable. Especially as a beginner, never turn to programming unless you have time to work carefully. Trying to write a “quick script” to solve a problem when a deadline looms can result in a very stressful situation. If you are in a rush, you might want to use conventional methods, even if they are monotonous and repetitive.

You might think that writing code is mysterious or difficult, but the basic principles use every-day reasoning and are quite accessible. Microsoft Office applications are created in such a way that they expose things called objects that can receive instructions, in much the same way that a phone is designed with buttons that you use to interact with the phone.

When you press a button, the phone recognizes the instruction and includes the corresponding number in the sequence that you are dialing.

In programming, you interact with the application by sending instructions to various objects in the application. These objects are expansive, but they have their limits. They can only do what they are designed to do, and they will only do what you instruct them to do.

For example, consider the user who opens a document in Word, makes a few changes, saves the document, and then closes it. Developers organize programming objects in a hierarchy, and that hierarchy is called the object model of the application.

Word, for example, has a top-level Application object that contains a Document object. The Document object contains Paragraph objects and so on. Object models roughly mirror what you see in the user interface. They are a conceptual map of the application and its capabilities. The definition of an object is called a class, so you might see these two terms used interchangeably.

In this case, when calling a procedure using Call, you must include the argument s between the parentheses. Switch the form to Form View and test the ellipse in the Circular tab.

Also test the cube and the box in the 3-Dimensions tab 7. Save and close the form 8. Before creating your own procedures, you should know what is already available so you don’t have to re-invent and waste a great deal of your time. The functions already created are very efficient and were tested in various scenarios so you can use them with complete reliability.

The available functions range in various types. There are so many of them that we can only review those that you are most likely to use very often. You can find out about the other in the Help files because they are fairly documented. Conversion Functions Anything the user types in a text-based field is primarily considered as a string.

Although Microsoft Access and Visual Basic perform a great deal of work behind the scenes to validate the various values that the user provides during data entry, sometimes you will need to make sure that a value is of the type you are expected. This is also valid even if the user did not enter a certain value, you would still need to retrieve a value and convert it to the right data type. There are various conversion functions adapted to the data types they are dealing with.

For example, it could be a string or value the user would have entered in form. It could also be the result of a calculation performed from other fields on the database. The function would take such a value, string, or expression and attempt to convert. If the conversion is successful, the function would return a new value that is of the type specified by the ReturnType in our syntax.

As opposed to a regular form, the user cannot type anything on the dialog box. There are usually two kinds of message boxes you will create: one that simply display information and one that expects the user to make a decision. There are two methods you can use to create a message box using the MsgBox function. To display a simple message with just an OK button, use the MsgBox method whose formula is MsgBox [Message] On the other hand, you can ask the message box to display a more informative prompt with more than one button.

Then you can write an expression that would perform an action based on the particular button the user clicked. In this case, you would have to use the MsgBox function not the method.

The MsgBox function takes five arguments. The Message argument is required on both. The Message argument is the string that the user will see displaying on the message box.

As a string, you can display it in double quotes, like this “That’s All Folks”. You can also create it from other pieces of strings. The Message argument can be made of up to characters. The Buttons argument specifies what button or buttons should display on the message box. There are different kinds of buttons available and Visual Basic recognizes them by a numeric value assigned to each.

You can set the default argument using the following table Option Value vbDefaultButton1 0 vbDefaultButton2 vbDefaultButton3 vbDefaultButton4 These additional buttons can be used to further control what the user can do: Constant Value vbApplicationModal 0 vbSystemModal In addition to the buttons, you can use the following icons on the message box Icon Value Description vbCritical 16 vbQuestion 32 vbExclamation 48 vbInformation 64 The Title argument is the caption that would display on the title bar of the message box.

It is a string whose word or words you can enclose between parentheses or that you can get from a created string. If your application is using a help file, you can specify this and let the message box use it. The HelpFile argument is a string that specifies the name of the help file, and the Context argument provides the number that corresponds to the appropriate help topic for the message box. As a function, the MsgBox function is useful for the value it returns. This value corresponds to the button the user clicks on the message box.

Double-click the Messages form to open it 3. Switch the form to Design View. Right-click the Message 1 button and click Build Event To test the form, return to Microsoft Access and switch the form to Form View.

On the form, click the Message 1 button. Notice that a message box displays. Also notice the caption on the title bar displays Microsoft Access.

Click OK to close the message box. Switch the form back to Design View and return to the Code Editor Instead of the title bar displaying Microsoft Access as the caption, you can set your own caption.

This is done through the 3rd argument of the MsgBox function. Test the form and the Message 2 button. Then return to the Code Editor When creating a message box using the MsgBox function, you can decide which button you want to use, using one of the constants we have listed earlier. Test the form and the Message 3 button. Return to the Code Editor If you want to display a message on different lines, you can use the vbCrLf constant.

Test the form and experiment with the Message 4 button. Then return to the Code Editor. You can also display a message on various lines using the Chr function. Test the form and the Message 5 button. The usefulness of the MsgBox function is demonstrated in your ability to perform an action based on the button the user has clicked on the message box.

Indeed, the implementations we have used so far were on the MsgBox method. If you want to get the button that the user has clicked, you have to use the function itself. The true capture of the clicked button is revealed by your finding out the clicked button. This is done using conditional statements that we have not learned so far.

Test the form and the Message 6 button. When a message box displays, one of the buttons, if more than one is displaying, has a thicker border than the other s ; such a button is called the default button.

By default, this is the 1st or most left button on the message box. If you want to control which button would be the default, use one of the default constant buttons listed above.

Test the form and the Message 7 button. Although the user cannot type on a message box, not only can you decide what it displays, but you can also use string variables that would be available only when the form is running. I don’t know where. But I bet we met somewhere. To test the form, return to Microsoft Access On the Employee Name text box, type Joseph Douglas Click the Message 8 button and see the result. Click one of the buttons to close the message box.

Close the running form, click its close button. Data Request With the Input Box Although most of the user’s data entry will be performed on fields positioned on a form, Microsoft Visual Basic provides a function that allows you to request a piece of information to the user who can type it in a text field of a dialog box.

The function used to accomplish this is called InputBox and its basic syntax is: InputBox prompt The most basic piece of information you should provide to the InputBox function is referred to as the prompt.

It should be a string that the user will read and know what you are expecting. The type of information the user is supposed to provide depends on you, the programmer. Therefore, there are two important things you should always do. First you should let the user know what type of information is requested. Is it a number what type of number? Is it a string such as the name of a country or a customer’s name?

Is it a date if it is a date, what format is the user supposed to enter? These questions can lead you to believe that you should state a clear request to the user and specify what kind of value you are expecting.

The second thing you should take care of is the value the user would have typed. After typing a value, the user would click one of the buttons: OK or Cancel. If the user clicks OK, you should retrieve the value the user would have typed. It is also your responsibility to find out whether the user typed a valid value. Because the InputBox function can return any type of value, it has no mechanism of validating the user’s entry.

To retrieve the value of the Input Box dialog when the user clicks OK, you must use the InputBox function and not the method as above. The problem is that you would still need to get the value of the text box and you might want to involve it in an expression. You can solve this problem and that of providing an example to the user by filling the text box with a default value.

Besides the prompt, Visual Basic provides a more elaborate InputBox function that allows you to specify more options, including a default value. This is taken care of by the Title. The IsEmpty function returns a Boolean value. The IsEmpty function is mostly used to check whether a field is empty.

Then you would use the result for another purpose. As a database developer, you create those forms and decide what controls are necessary to make your database a good product. To make the forms of your database as useful as possible, you should know what the various controls provide, which is primarily their properties. A property is something that characterizes or describes an object.

A property can be the name of an object, its color, the text it displays, or its width. Controls Properties When designing a form and manipulating Windows controls, you will use a central object called the Properties Window: Made of five property sheets, the Properties window displays the properties associated with the object or the control that is selected on the form. To get the Properties window of the properties associated with a control, right-click that control and click Properties.

To display the Properties window for the form, double-click the button that is at the intersection of both rulers. You can also click the Properties button on the Form Design toolbar to toggle the Properties windows. Characteristics that control the form’s appearance are listed in the Format property sheet.

Characteristics that control internal or external relationships, as far as data is concerned, are listed in the Data property sheet. The Other property sheet lists characteristics that don’t fit in one of the other groups. When dealing with a particular characteristic, you can access it from one of those property sheets or you can use the whole list of properties from the All property sheet. In the Forms section, Right-click Suppliers and click Design.

To display the Properties window, double-click the button at the intersection of the rulers. Notice that the Properties window displays 5 property sheets 4. To close the form, click its close button. Properties Categories Properties are set by changing their values and there are various types of properties.

Although you can click it to select it, you cannot change it. The property name can be made of one word such as Width; it can also be made of a combination of words, such as Record Source. On this site, a property will be called by what displays on that left gray section.

This means that, if a property displays “Height”, we will call it “The Height Property”. In Visual Basic, the name of a property is made of one word starting in uppercase.

Examples are Text or Caption. If the property is a combination of words, each component of the word would start in uppercase. Examples are RecordSource or AllowAdditions. Not all properties of the Microsoft Access’ Properties window are exactly reproduced in Visual Basic but most of them are. And most of the properties have the same name, in one word. Before referring to a property in Visual Basic, you must first call the control whose property you want to use. There are various ways you can call a control.

If you know the name of a control, you can type it and assign it default value. In Visual Basic, a form refers to itself as Me. In the Code Editor, after typing Me, type the period operator. Visual Basic would display the list of properties and the controls that the form is hosting. This allows you to select the control or property you need. In the Properties window, to give a value to a property, you type the desired value in the field on the right side of the name of you proceed as we will learn shortly, depending on the property type.

In Visual Basic, to change the value of a property, you can assign it the desired value, using the assignment operator String Properties In the Properties window, some properties display a word or a group of words. Such a word or group of words on a field is called a string. Some of those properties already display a value while some others are empty. To set or change such a string, you can click the property name and type the desired value, which would replace whatever text the property was displaying.

Alternatively, you can edit the text that the property already has. There are various types of string properties on the form and other controls. Examples include among others, the control’s name or its caption. To provide a string value to a property in Visual Basic, use the assignment operator and type the text in double-quotes. A name allows the database engine and the computer to identify each object for any necessary reference.

Although the name of a table query, form, or report doesn’t appear as obvious as some other controls, as a property, it is highly valuable when creating expressions that involve the table query, form, or report. There are two main ways an object in this section, the word object includes not only the form but other Windows controls that we will be using during form and report designs receives a name.

If you create a form using the New Object button on the Table Datasheet toolbar, by default, Microsoft Access gives it the same name as the form or the query where its data originates from. Also, when you create a form using the Form Wizard, Microsoft Access would suggest the name of the source table or query to the form. In these last two examples, you can accept the suggested name. Because a form and a table are two distinct objects, they can have the same name without any conflict.

As an example, if you create a database using the Database Wizard, you would see that the tables and forms hold the same names. The second option you have is to change the suggested name of the form.

As we did with the tables, to set the name of a form, if it has not been previous saved by you , you must ask to save the form and give the name you want. The name of a form follows the same rules we applied to tables.

In this case, to identify a form as such, you can start its name with frm followed by a word or group of words that can easily identify what the form is being used for. In the Forms section, right-click Suppliers and click Copy 2.

Right-click an unoccupied area in the Forms section and click Paste 3. In the Paste As dialog box, type frmSuppliers and press Enter twice the first Enter register the name, the second Enter opens the form.

String Properties: The Caption The most upper characteristic that appear on a form is the word or group of words on the title bar. This is called the caption of the form and it is controlled by the Caption property. By default, the title bar displays the name of the form.

To change this title, access the Caption field in the Format property sheet and type the desired title. Just like the caption of a table, the title of a form is not related to the form’s name; therefore, you can type any caption you want, but a caption should reflect what the form is being used for. To change the caption of the form, on the Properties window, click Format 3. The cursor should be blinking in the Caption field; if not, click Caption. To view the caption, you must switch to Form View.

Boolean Fields Some fields behave like a True or False answer to a question. Such fields can display only one of two values. Both values come in a combo box that displays as the property field. There are two main ways you use a Boolean field: either to set its value or to find out what value the field is holding. When studying conditional statements, we will learn the mechanics of finding out what value a property is holding.

To change the value of the field in the Properties window, click the field to display its combo box. Then click the arrow of the combo box and select the other value. To change the value of a Boolean field or variable in Visual Basic, assign it a True or False value, depending on your goals.

From the list, you can select and double-click True or False. Of course, it is faster and easier to type the desired value since you already know what it should be. If you are invoking a property of the Properties window, it is likely that Visual Basic is already aware that the property is Boolean.

Navigating Buttons When studying tables and during form’s data entry, we found out that a form also a table, a query, or a report is equipped with some buttons on its lower section.

These buttons allow the user to navigate back and forth through records. These buttons are very useful during data entry and data analysis. If you are creating a form that would display the same content all the time, such as a form that doesn’t actually display records, you can hide the form navigation buttons. The presence or absence of navigation buttons is controlled by the Boolean Navigation Buttons property.

When its value is set to Yes, the form would display the Navigation Buttons. To hide them, set the Navigation Buttons property value to No. Practical Learning: Hiding the Navigation Buttons 1. On the Form Design toolbar, click the Code button. Notice that the form doesn’t have the bottom navigation buttons. The list, which is static, which means it cannot be changed, comes as a combo box where the user in this case the user is the database developer can select one item from. To change the property value in the Properties window, click the arrow of the combo box and select the desired value from the list.

To set or change the value of an enumerated property in Visual Basic, you must know the value you want. There are two main alternatives: using your experience or getting help.

If you know the possible values of the property, you can assign the desired value to the property name. If you don’t know the possible values, you can get back to the Properties window, click the arrow of the combo box that is the property whose value you want to assign, view and write down the possible values.

Here is an example: Once you have the list of possible values, you can get to the Code Editor and get ready to assign the desired value. Many of the values of properties from the Properties window are not exactly equivalent in Visual Basic.

This means that you may not use the same values as in the Properties window. The help files can give you the list of possible values.

Numeric Properties Some properties use a value that is a number. There are two types of numbers you will be asked to provide, depending on the property. An integer is a number that doesn’t take a decimal portion. Such a number can be made of digits only. File Name:. Access Developer Documentation. Date Published:. File Size:. System Requirements Supported Operating System.

Install Instructions Choose one or more of the Download buttons on this page to start downloading the reference or references you want. Do one of the following: To start the installation, choose Open or Run this program from its current location.

To copy the download to your computer for installation at a later time, choose Save or Save this program to disk.

To open the CHM file, double-click the file in Windows Explorer at the disk location where you saved it. Click Unblock , and then click OK.

 
 

 

Microsoft Access Plain Simple PDF Book | Free PDF Books

 
As of today we have 79,, eBooks for you to download for free. Because Access is part of Microsoft Office , you can. Download free an introduction to MS access , course material, tutorial training, a PDF file on 18 pages. Size: KB; Downloads: Access An.

 
 

Related Post