Learn Microsoft Access Advanced Programming Techniques, Tips and Tricks.

Access Live Data in Excel-2


Continued from last Week's Post

p>
This is the continuation of the earlier Post Access Live Data in Excel. Please go through the earlier Article before continuing.

If you want to make changes to the Query that you have created for bringing Access Data into Excel you may do so.

  1. Click in a cell within the Data Area on the Worksheet.
  2. Point to Import External Data (Get External Data in MS-Office2000) in Data Menu.
  3. Select Edit Query from the displayed Menu. The Wizard will guide you through the earlier selections and you can modify them before saving the Query.

Microsoft Query.

Alternatively you can open Microsoft Query Program (C:\Program Files\Microsoft Office\Office11\MSQRY32.EXE in MS-Access 2003) and open the saved Query (Refer earlier Post Access Live Data in Excel for Query File's default location) from File Menu, edit the SQL String and view the Output data in the Query Editor before saving the changes.

When you open the Query that you have created and saved earlier the Source Data will be displayed in Datasheet View. Click on the SQL labeled Toolbar Button or select SQL. . . from View menu.

You will find the SQL String like the sample given below:

SELECT Categories.CategoryID,
 Categories.CategoryName,
 Categories.Description,
 Categories.Picture
FROM `C:\Program Files\Microsoft Office\Office11\samples\Northwind`.Categories Categories

The normal SQL terminator character semicolon (;) is not present. The FROM Clause in the SQL is written differently without the use of an IN Clause, which we have seen in the MS-Access Query to Open Excel or Dbase Tables directly using Source Connect Str Property. The Categories Table Name is attached to the sample Database Path Name with a dot separator and the Table Name is repeated with a space in between. The .mdb file extension to Northwind is also omitted from the database file name specification.

If you Copy and paste the above SQL String into an MS-Access Query and change into Datasheet View it will display the data correctly. No errors will be displayed except some Column headings may appear as Expr3, Expr4 and so on, if you have changed the Query into Design View first and then switched into Datasheet View.


Properties of Microsoft Query

This is the time to learn the usage of two more Properties of MS-Access Query.

  1. Copy the above SQL String into a new MS-Access Query SQL window.
  2. Select View - -> Datasheet View to display Records from the Categories Table from Northwind.mdb database.
  3. Select View - -> Design View to change the Query into Design View.
  4. The Table Object is already visible on the Query Design surface, but the Field Names are absent. Click on the Title area of the Table to select it.
  5. Display the Property Sheet (View - -> Properties. The Alias and Source Properties of the Query are displayed.
  6. The Table Name Categories is loaded in the Alias Property and the Path Name of the NorthWind database is appearing in the Source Property without the .mdb extension.
  7. Change the Table Name appearing in the Alias Property into something different, say myCategories.
  8. Add .mdb extension at the end of Path name string in the Source Property.

The Table Name is now appearing as myCategories on the Title of the Table. If you change the Query into SQL View you can see that at the end of the SQL String the reference to the Table name .Categories Categories (appeared twice earlier) has now changed to .Categories As myCategories.

We must qualify each data field with the Table Name myCategories due to the Alias Name change. Change the SQL String as shows below qualifying each Field with the Alias Name. Enclose the Database Path Name in Square Brackets ([]) in place of single quotes.

SELECT [myCategories].[CategoryID],
 [myCategories].[CategoryName],
 [myCategories].Description,
 [myCategories].Picture
FROM [d:\Program Files\Microsoft Office\Office\samples\Northwind.mdb].Categories AS myCategories;

The manual change is necessary because we are referencing an external data source and no way MS-Access can guess the name. If we are using a Table from within the Database or a linked Table then the Alias Name change will automatically take effect on all the fields. You may try this experiment with one of your own Table from within the Database or with a linked Table.

Note: The Source Database and Source Connect Str Property Values are taken into the Query Syntax with an IN Clause to identify the external Application.

Alias Property is initially set with the Table Name and accepts changes to the Table Name through this Property.

Source Property accepts the external Database reference, either direct Path Name or an ODBC Connection String and the SQL Syntax is different in the FROM Clause of the Query definition.

  1. Roundup Function
    of Excel in MS-Access
  2. Proper Function of
    Excel in Microsoft Access
  3. Appending Data from
    Excel to Access
  4. Writing Excel
    Data Directly into Access
  5. Printing MS-Access
    Report from Excel
  6. Copy Paste Data
    From Excel to Access2007
  7. Microsoft Excel Power
    in MS-Access
  8. Rounding Function
    MROUND of Excel
  9. MS-Access Live Data in
    Excel
  10. Access Live Data in Excel-
    2
  11. Opening Excel Database
    Directly
  12. Create Excel Word
    File from Access
Share:

No comments:

Post a Comment

Comments subject to moderation before publishing.


Translate



PageRank
Subscribe in a reader
Your email address:

Delivered by FeedBurner

Search

Popular Posts

Empty Gadget

Blog Archive

Powered by Blogger.

Follow by Email

Labels

Forms Functions How Tos MS-Access Security Reports Class Module msaccess forms Animations msaccess animation Utilities msaccess controls Access and Internet MS-Access Scurity MS-Access and Internet Array External Links Queries msaccess reports Downloads msaccess tips Accesstips Objects Collection Object Property Event Menus and Toolbars Controls MsaccessLinks Process Controls WithEvents Art Work VBA msaccess How Tos Combo Boxes Dictionary Object Graph Charts List Boxes Query msaccessQuery Calculation Command Buttons Form Report Command Button Data Emails and Alerts RaiseEvent Custom Functions Custom Wizards DOS Commands Data Type Object Reference ms-access functions msaccess functions msaccess graphs msaccess reporttricks Item Key msaccessprocess security advanced Access Security Add Auto-Number Field Type Fields Form Instances Macros Menus Recordset SubForm Top Values Variables msaccess email msaccess menus progressmeter Access2007 Copy Excel Expression Join Methods Microsoft Numbering System Records Security Split Table Time Difference Utility Workgroup Wrapper Classes database function ms-access msaccess wizards reference text tutorial vba code Access Emails and Alerts Access Fields Access How Tos Access Mail Merge Access2003 Accounting Year Action Animation Attachment Binary Numbers Bookmarks Budgeting ChDir Color Palette Conditional Formatting Data Filtering Database Records Defining Pages Diagram Disk Dynamic Lookup Error Handler Export External Filter Formatting Groups Hexadecimal Numbers Import Labels List Logo Macro Mail Merge Main Form Memo Monitoring Octal Numbers Operating System Paste Primary-Key Product Rank Reading Remove Rich Text Sequence SetFocus Summary Tab-Page Tables Union Query User Users Water-Mark Word automatically commands hyperlinks iSeries Date iif msaccess msaccess alerts pdf files restore switch toolbar updating upload

Featured Post

Word Mail-Merge with Ms-Access Table

Introduction. Form Letters. Form Letters are prepared from a standard Microsoft Word template merged with addressee related information fill...

Labels

Blog Archive

Recent Posts