very important access menu command

5
You want to open any other software application from a button menu in MS Access. For example, you want to open the document named “CORPORATE HOUSE STYLE” contained in one of your directories through a menu created in MS Access. Follow these steps in the same order: 1) Create a blank form in MS Access: 2) Insert a button into the form: NOTE: Click the cancel button on the Command Button Wizard. You will build the code for the button yourself.

Upload: msaad4444

Post on 04-Dec-2015

216 views

Category:

Documents


4 download

DESCRIPTION

a

TRANSCRIPT

You want to open any other software application from a button menu in MS Access.For example, you want to open the document named CORPORATE HOUSE STYLE contained in one of your directories through a menu created in MS Access.Follow these steps in the same order:1) Create a blank form in MS Access:

2) Insert a button into the form:

NOTE: Click the cancel button on the Command Button Wizard. You will build the code for the button yourself.

3) Right Click on the button and select the Build Event option. Then select Build Code option.

The following window would then appear on the screen:

4) Now, enter the following code:

Private Sub Command0_Click()

Dim A As ObjectSet A = CreateObject("Word.Application")A.Visible = TrueA.Documents.Open "D:\SAAD\WORK\AICT\A1\REPORTS\CORPORATE HOUSE STYLE.docx"

End Sub

You can give any name to your object. In this case it is named A

Give the file path name.

5) Now when you would click the button in the Form View, the document would open.