Wednesday, November 6, 2013

MS OFFICE ACCESS 2010 Creating Blank Database Form and VBA code module


-----

1) Create New MS Office Access Database
2) Creating New Form
3) Adding Control Objects into the form
4) Using Object Properties Panel
5) Adding VBA codes


1) Create New MS Office Access Database

1.1) Go to File/New
1.2) In the available templates, select Blank database.
1.3) In the File Name text box (on the right side of application window), type the name MyDbVba1.accdb
Click Create.
1.4) New Database is created.

2) Creating New Form

2.1) Click Create Tab.
Click Blank Form button.
2.2) A new form is created.

3) Adding Control Objects into the form

3.1) There are a number of control objects on the form.
3.2) Click Textbox object and then click on a blank area on the form.
Repeat for a second time.
Don’t worry about the name.
3.3) Add a button control.
Click the button icon.
Click on an area below the text box.
When a Command Button dialog box appears, click Cancel.
Don’t worry about the name/label of the button.

4) Using Object Properties Panel

4.1) Find the Property Sheet button and click it.
4.2) Property Sheet will be displayed at the right side of the application window.
4.3) Change the name of the objects as follows:
lblInput1
txtInput1
lblInput2
txtInput2
cmdButton1
        
You can change the caption of the objects by going to the Format Tab and edit the Caption field.

5) Adding VBA codes

5.1) In the Property Sheet, find the Event Tab.
Make sure the button labeled as Process is selected.
Under the Event tab, find the On Click event, click “…” button.
5.2) When the Choose Builder dialog window pops up, choose Code Builder.
5.3) You may get error message.
5.4) Switch to Design View.
5.5) In the Property Sheet, select Form and set Has Module Property to Yes.
5.6) Repeat Step 5.1 and 5.2.
VBA Editor window appears.
5.7) Type :
    MsgBox "Hello", , "Test"
5.8) Test Run.
Find the Run button and click it.
5.9) Go back to Access.
5.10) Click View/Form View
5.11) If you click the button labeled as “Process”, you should get the Message Box dialog window as follows:





DOWNLOAD: 


MS OFFICE ACCESS 2010 CREATING NEW DATABASE FROM TEMPLATE


-----

1) Create a new document from online template.
1.1)Click File/New.
1.2) In the Available Templates, choose Sample templates.
1.3) Continue with selecting the Students template.
Double-click the icon.
1.4) A new database is created.
You may get security warning message.
Click Enable Content.
1.5) Notice the command menu and navigation pane which you can use to work with database and its objects.

Thursday, October 31, 2013

Creating Form For Macro In Microsoft Access





1) Creating A Form
2) Adding a Command Button to the form
3) Manually set the properties for Command Button
5) Adding an Event Listener to the Command Button
6) Running the Form

1) Creating A Form

1.1) Click Create Tab.
Click Form Design button.
1.2) Outcome:

2) Adding a Command Button to the form

2.1) Click Design Tab.
Click the Command Button.
2.2) Click and drag the mouse on the Form Detail Section to make a box shape for the button.
2.3) The Command Button Wizard window automatically pops up.
Click Cancel.
2.4) Outcome:
The button is given a default name Command0.

3) Manually set the properties for Command Button

3.1) Right-hand click the Command0 button.
3.2) In the Property Sheet type “Hello World!” in the Caption field.
Close the Property Sheet window.
3.3) Outcome:
4) Running the Form
4.1) Click the Form View button.
4.2) Outcome:

5) Adding an Event Listener to the Command Button

5.1) Click the Event Tab.
In the On Click field, find the name “mcrHelloWorld”.

6) Running the Form

6.1) Click the Form View button.
6.2) Outcome:

Creating A Macro In Microsoft Office Access



1) Creating A Macro
2) Macro User-Interface
3) Hiding Objects Panel
4) Adding a command
5) Command and Arguments
6) Running A Macro
7) Closing Macro Window
8) Finding Macro Object in Objects Panel

1) Creating A Macro

  1. Click Create Tab
  2. Click Macro Button

2) Macro User-Interface

3) Hiding Objects Panel

3.1) Click the close icon on top right of Objects Panel to close the panel and give more space to Macro Editor Panel

4) Adding a command

  1. Click the drop-down button and select MessageBox
  1. Outcome:

5) Command and Arguments

5.1) Type “Hello World!” in the Message field.
5.2) Set Type field to Information.
5.3) Type “Our first message”

6) Running A Macro

6.1) Click the Run button.
6.2) You may be prompted to save your macro first.
6.3) Save it as “mcrHelloWorld”
6.4) Outcome:

7) Closing Macro Window

7.1) Look at the top right corner of the Macro Editor panel.
Click the close button.
(Notice that you will see the “Close ‘mcrHelloWorld’” when your mouse hovers the right close button)

8) Finding Macro Object in Objects Panel

8.1) You can find the Macro “mcrHelloWorld” under the title “Macros” in the Objects Panel.