<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Bacon Bits: &#187; Excel &amp; Access Integration</title>
	<atom:link href="http://datapigtechnologies.com/blog/index.php/category/excel-and-access-integration/feed/" rel="self" type="application/rss+xml" />
	<link>http://datapigtechnologies.com/blog</link>
	<description>A DataPig Technologies Blog</description>
	<lastBuildDate>Fri, 30 Jul 2010 08:06:04 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Can’t Export More than 65,000 Rows to Excel 2007?</title>
		<link>http://datapigtechnologies.com/blog/index.php/cant-export-more-than-65000-rows-to-excel-2007/</link>
		<comments>http://datapigtechnologies.com/blog/index.php/cant-export-more-than-65000-rows-to-excel-2007/#comments</comments>
		<pubDate>Thu, 22 Apr 2010 11:37:29 +0000</pubDate>
		<dc:creator>datapig</dc:creator>
				<category><![CDATA[Access Tips and Tricks]]></category>
		<category><![CDATA[Excel & Access Integration]]></category>
		<category><![CDATA[Access]]></category>
		<category><![CDATA[Annoyances]]></category>
		<category><![CDATA[Excel]]></category>
		<category><![CDATA[Integration]]></category>
		<category><![CDATA[Tips and Tricks]]></category>

		<guid isPermaLink="false">http://datapigtechnologies.com/blog/?p=1930</guid>
		<description><![CDATA[Kusleika and I are at the Excel and Access Power User Workshop this week. Between you and me, he's not doing that well.
Anyway, one of our attendees asked why Access 2007 can't export more than 65,000 rows to Excel 2007. I replied with my usual professorial demeanor "What? You're on crack!"
This is when he demonstrated [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.dailydoseofexcel.com" target="_blank">Kusleika</a> and I are at the Excel and Access Power User Workshop this week. Between you and me, he's not doing that well.</p>
<p>Anyway, one of our attendees asked why Access 2007 can't export more than 65,000 rows to Excel 2007. I replied with my usual professorial demeanor "What? You're on crack!"</p>
<p>This is when he demonstrated these steps:</p>
<p><span id="more-1930"></span></p>
<ol>
<li><strong>Right click on the Table or Query<br />
</strong></li>
<li>
<div><strong>Click Export -&gt; Excel<br />
</strong></div>
<p> </p>
<p><img src="http://datapigtechnologies.com/blog/wp-content/uploads/2010/04/042210_1137_CantExportM1.png" alt="" /><strong><br />
</strong></p>
<p> </li>
<li><strong>Click the "Export data with formatting" option<br />
</strong></li>
<li><strong>Press OK<br />
</strong></li>
</ol>
<p><img src="http://datapigtechnologies.com/blog/wp-content/uploads/2010/04/042210_1137_CantExportM2.png" alt="" /></p>
<p> </p>
<p> </p>
<p>After a few gyrations, Access pops up this nasty-gram. Indeed, the table gets cut off at 65,000 lines.</p>
<p><img src="http://datapigtechnologies.com/blog/wp-content/uploads/2010/04/042210_1137_CantExportM3.png" alt="" /></p>
<p> </p>
<p> </p>
<p>Of course, being the expert I am, I immediately pointed out the issue.</p>
<p>The problem comes from the selection of "<strong>Export data with formatting" </strong>in Step 3.</p>
<p>If you uncheck this (leave it not checked), Access will export more than 65,000 rows just fine.</p>
<p><img src="http://datapigtechnologies.com/blog/wp-content/uploads/2010/04/042210_1137_CantExportM4.png" alt="" /></p>
<p> </p>
<p> </p>
<p>The reason for this isn't all that transparent, but it's pretty simple.</p>
<p>When the <strong>Export data with formatting </strong>option is checked, the windows clipboard is used. That is, Access will send the data to the Windows clipboard so that all the formatting and layout can be copied. The problem is that the old windows clipboard limits you to only 65,000 lines of data. Leaving this option unchecked allows access to simply transfer the data, bypassing the need for the windows clipboard. Problem solved.</p>
<p> </p>
<p>He was pretty happy with this answer &#8211; although, he still wants his money back.</p>
]]></content:encoded>
			<wfw:commentRss>http://datapigtechnologies.com/blog/index.php/cant-export-more-than-65000-rows-to-excel-2007/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The Case for Access</title>
		<link>http://datapigtechnologies.com/blog/index.php/the-case-for-access/</link>
		<comments>http://datapigtechnologies.com/blog/index.php/the-case-for-access/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 05:57:31 +0000</pubDate>
		<dc:creator>datapig</dc:creator>
				<category><![CDATA[Excel & Access Integration]]></category>
		<category><![CDATA[~ Bacon Bits]]></category>
		<category><![CDATA[Access]]></category>
		<category><![CDATA[Excel]]></category>
		<category><![CDATA[Integration]]></category>
		<category><![CDATA[Misc]]></category>

		<guid isPermaLink="false">http://datapigtechnologies.com/blog/index.php/the-case-for-access/</guid>
		<description><![CDATA[Amazon says it's official. My new book will be out on April 5th.
This book is written for all you Excel users who know that expanding your skill-set to include Access can make you more productive. I guide you through analytical and reporting benefits of Access, and show you how you can integrate Excel and Access [...]]]></description>
			<content:encoded><![CDATA[<p>Amazon says it's official. My new book will be out on April 5<sup>th</sup>.</p>
<p>This book is written for all you Excel users who know that expanding your skill-set to include Access can make you more productive. I guide you through analytical and reporting benefits of Access, and show you how you can integrate Excel and Access to make your life easier.</p>
<p><a href="http://www.amazon.com/Excel-Analysts-Guide-Access/dp/0470567015/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1268198951&amp;sr=1-1" target="_blank"><img style="border: 0px;" src="http://datapigtechnologies.com/blog/wp-content/uploads/2010/03/031010_0557_TheCaseforA1.jpg" border="0" alt="" width="201" height="189" /></a></p>
<p> </p>
<p>To celebrate this new arrival, I've decided to post Chapter 1 of this book as today's blog entry. Enjoy!</p>
<p><span id="more-1803"></span></p>
<p><strong><em><span style="color:#632423">Excerpt from <a href="http://www.amazon.com/Excel-Analysts-Guide-Access/dp/0470567015/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1268199987&amp;sr=1-1" target="_blank"></a></span>Excel Analyst's Guide to Access<span style="color:#632423"> (ISBN: 0470567015).  Written by Mike Alexander; published by Wiley Publishing, Inc. Reprinted with permission from Wiley Publishing, Inc. &#8211; All rights reserved.</span></em><br />
</strong></p>
<p><span style="font-size:14pt"><strong><span style="color: #ffffff;">.</span></strong></span></p>
<p><span style="font-size:14pt"><strong>THE CASE FOR DATA ANALYSIS IN ACCESS<br />
</strong></span>     When you ask most people which software tool they use for their daily data analysis, the answer you most often get is Excel. Indeed, if you were to enter the key words data analysis in an Amazon.com search, you would get a plethora of books on how to analyze your data with Excel. Well if so many people seem to agree that using Excel to analyze data is the way to go, why bother using Access for data analysis? The honest answer: to avoid the limitations and issues that plague Excel.</p>
<p>     This is not meant to disparage Excel. Many people across varying industries have used Excel for years, considering it the tool of choice for performing and presenting data analysis. Anyone who does not understand Excel in today's business world is undoubtedly hiding that shameful fact. The interactive, impromptu analysis that Excel can perform makes it truly unique in the industry. However, Excel is not without its limitations, as you will see in the following section.</p>
<p> </p>
<p><span style="font-size: 12pt; text-decoration: underline;"><strong>Where Data Analysis with Excel Can Go Wrong<br />
</strong></span></p>
<p>     Years of consulting experience have brought me face to face with managers, accountants, and analysts who all have had to accept one simple fact: Their analytical needs had outgrown Excel. They all met with fundamental issues that stemmed from one or more of Excel's three problem areas: scalability, transparency of analytical processes, and separation of data and presentation.</p>
<p> </p>
<p><strong>Scalability<br />
</strong></p>
<p>    Scalability is the ability of an application to develop flexibly to meet growth and complexity requirements. In the context of this chapter, scalability refers to Excel's ability to handle ever-increasing volumes of data. Most Excel aficionados will be quick to point out that as of Excel 2007, you can place 1,048,576 rows of data into a single Excel worksheet. This is an overwhelming increase from the limitation of 65,536 rows imposed by previous versions of Excel. However, this increase in capacity does not solve all of the scalability issues that inundate Excel.</p>
<p>    Imagine that you are working in a small company and you are using Excel to analyze your daily transactions. As time goes on, you build a robust process complete with all the formulas, pivot tables, and macros you need to analyze the data stored in your neatly maintained worksheet.</p>
<p>   As your data grows, you will first notice performance issues. Your spreadsheet will become slow to load and then slow to calculate. Why will this happen? It has to do with the way Excel handles memory. When an Excel file is loaded, the entire file is loaded into memory. Excel does this to allow for quick data processing and access. The drawback to this behavior is that each time something changes in your spreadsheet, Excel has to reload the entire spreadsheet into memory. The net result in a large spreadsheet is that it takes a great deal of memory to process even the smallest change in your spreadsheet. Eventually, each action you take in your gigantic worksheet will become an excruciating wait.</p>
<p>     Your pivot tables will require bigger pivot caches, almost doubling your Excel workbook's file size. Eventually, your workbook will be too big to distribute easily. You may even consider breaking down the workbook into smaller workbooks (possibly one for each region). This causes you to duplicate your work. Not to mention the extra time and effort it would take should you want to recombine those workbooks.</p>
<p>   In time, you may eventually reach the 1,048,576-row limit of your worksheet. What happens then? Do you start a new worksheet? How do you analyze two datasets on two different worksheets as one entity? Are your formulas still good? Will you have to write new macros?  These are all issues you need to deal with.</p>
<p>    Of course, you will have the Excel power-users, who will find various clever ways to work around these limitations. In the end, though, they will always be just workarounds. Eventually, even these power-users will begin to think less about the most effective way to perform and present analysis of their data and more about how to make something "fit" into Excel without breaking their formulas and functions. Excel is flexible enough that a proficient user can make most things fit into Excel just fine. However, when users think only in terms of Excel, they are undoubtedly limiting themselves, albeit in an incredibly functional way.</p>
<p>   In addition, these capacity limitations often force Excel users to have the data prepared for them. That is, someone else extracts large chunks of data from a large database and then aggregates and shapes the data for use in Excel. Should the serious analyst always be dependent on someone else for his or her data needs? What if an analyst could be given the tools to access vast quantities of data without being reliant on others to provide data? Could that analyst be more valuable to the organization? Could that analyst focus on the accuracy of the analysis and the quality of the presentation, instead routing Excel data maintenance?</p>
<p>    Access is an excellent (many would say logical) next step for the analyst who faces an ever-increasing data pool. Since an Access table takes very few performance hits with larger datasets and has no predetermined row limitations, an analyst will be able to handle larger datasets without requiring the data to be summarized or prepared to fit into Excel. Since many tasks can be duplicated in both Excel and Access, an analyst proficient at both will be prepared for any situation. The alternative is telling everyone, "Sorry, it is not in Excel."</p>
<p>   Also, if ever a process becomes more crucial to the organization and needs to be tracked in a more enterprise-acceptable environment, it will be easier to upgrade and scale up if that process is already in Access.</p>
<p> </p>
<p><strong>Transparency of Analytical Processes<br />
</strong></p>
<p>     One of Excel's most attractive features is its flexibility. Each cell can contain text, a number, a formula, or practically anything else the user defines. Indeed, this is one of the fundamental reasons Excel is such an effective tool for data analysis. Users can use named ranges, formulas, and macros to create an intricate system of interlocking calculations, linked cells, and formatted summaries that work together to create a final analysis.</p>
<p>   So what is the problem with that? The problem is that there is no transparency of analytical processes. Thus, it is extremely difficult to determine what is actually going on in a spreadsheet. Anyone who has had to work with a spreadsheet created by someone else knows all too well the frustration that comes with deciphering the various gyrations of calculations and links being used to perform some analysis. Small spreadsheets performing modest analysis are painful to decipher, while large, elaborate, multi-worksheet workbooks are virtually impossible to decode, often leaving you to start from scratch.</p>
<p>    Even auditing tools available with most Excel add-in packages provide little relief. The figure below shows the results of a formula auditing tool run on an actual workbook used by a real company. It's a list of all the formulas in this workbook. The idea is to use this list to find and make sense of existing formulas. Notice that line one shows that there are 156 formulas. Yeah, this list helps a lot; good luck.</p>
<p><img src="http://datapigtechnologies.com/blog/wp-content/uploads/2010/03/031010_0557_TheCaseforA2.png" alt="" /></p>
<p> </p>
<p>   Compared to Excel, Access might seem rigid, strict, and unwavering in its rules. No, you can't put formulas directly into data fields. No, you can't link a data field to another table. To many users, Excel is the cool gym teacher who lets you do anything, while Access is the cantankerous librarian who has nothing but error messages for you. All this rigidity comes with a benefit, however.</p>
<p>   Since only certain actions are allowable, you can more easily come to understand what is being done with a set of data in Access. If a dataset is being edited, a number is being calculated, or if any portion of the dataset is being affected as a part of an analytical process, you will readily see that action. This is not to say that users can't do foolish and confusing things in Access. However, you definitely will not encounter hidden steps in an analytical process such as hidden formulas, hidden cells, or named ranges in dead worksheets.</p>
<p> </p>
<p><strong>Separation of Data and Presentation<br />
</strong></p>
<p>     Data should be separate from presentation; you do not want the data to become too tied to any particular way of presenting it. For example, when you receive an invoice from a company, you don't assume that the financial data on that invoice is the true source of your data. Rather, it is a presentation of your data. It can be presented to you in other manners and styles on charts or on websites, but such representations are never the actual source of data. This sounds obvious, but it becomes an important distinction when you study an approach of using Access and Excel together for data analysis.</p>
<p>     What exactly does this concept have to do with Excel? People who perform data analysis with Excel, more often than not, tend to fuse the data, the analysis, and the presentation together. For example, you will often see an Excel Workbook that has 12 worksheets, each representing a month. On each worksheet, data for that month is listed along with formulas, pivot tables, and summaries. What happens when you are asked to provide a summary by quarter? Do you add more formulas and worksheets to consolidate the data on each of the month worksheets? The fundamental problem in this scenario is that the worksheets actually represent data values that are fused into the presentation of your analysis. The point here is that data should not be tied to a particular presentation, no matter how apparently logical or useful it may be. However, in Excel, it happens all the time.</p>
<p>     In addition, as previously discussed, because all manners and phases of analysis can be done directly within a spreadsheet, Excel cannot effectively provide adequate transparency to the analysis. Each cell has the potential of holding formulas, being hidden, and containing links to other cells. In Excel, this blurs the line between analysis and data, which makes it difficult to determine exactly what is going on in a spreadsheet. Moreover, it takes a great deal of effort in the way of manual maintenance to ensure that edits and unforeseen changes don't affect previous analyses.</p>
<p>     Access inherently separates its analytical components into tables, queries, and reports. By separating these elements, Access makes data less sensitive to changes and creates a data analysis environment where you can easily respond to new requests for analysis without destroying previous analyses.</p>
<p>     Many who use Excel will find themselves manipulating its functionalities to approximate this database behavior. If you find yourself in this situation, you must consider that if you are using Excel's functionality to make it behave like a database application, perhaps the real thing just might have something to offer. Utilizing Access for data storage and analytical needs would enhance overall data analysis and would allow the Excel power-user to focus on the presentation in his or her spreadsheets.</p>
<p>     In the future, there will be more data, not less. Likewise, there will be more demands for complex data analysis, not fewer. Power-users are going to need to add some tools to their repertoire in order to get away from being simply spreadsheet mechanics. Excel can be stretched to do just about anything, but maintaining such creative solutions can be a tedious manual task. You can be sure that the sexy part of data analysis is not in routine data management within Excel. Rather, it is in the creation of slick processes and utilities that will provide your clients with the best solution for any situation.</p>
<p> </p>
<p> </p>
<p><span style="font-size: 12pt; text-decoration: underline;"><strong>Deciding Whether to Use Access or Excel<br />
</strong></span></p>
<p>     After such a critical view of Excel, it is important to say that the key to your success in the sphere of data analysis will not come from discarding Excel altogether and exclusively using Access. Your success will come from proficiency with both applications and the ability to evaluate a project and determine the best platform to use for your analytical needs. Are there hard-and-fast rules you can follow to make this determination? The answer is no, but there are some key indicators in every project you can consider as guidelines to determine whether to use Access or Excel. These indicators are the size of the data; the data's structure; the potential for data evolution; the functional complexity of the analysis; and the potential for shared processing.</p>
<p> </p>
<p><strong>Size of Data<br />
</strong></p>
<p>     The size of your dataset is the most obvious consideration you will have to take into account. Although Excel can handle more data than in previous versions, it is generally a good rule to start considering Access if your dataset begins to approach 100,000 rows. The reason for this is the fundamental way Access and Excel handle data.</p>
<p>     When you open an Excel file, the entire file is loaded into memory to ensure quick data processing and access. The drawback to this behavior is that Excel requires a great deal of memory to process even the smallest change in your spreadsheet. You may have noticed that when you try to perform an AutoFilter on a large formula-intensive dataset, Excel is slow to respond, giving you a Calculating indicator in the status bar. The larger your dataset is, the less efficient the data crunching in Excel will be.</p>
<p>     Access, on the other hand, does not follow the same behavior as Excel. When you open an Access table, it may seem as though the whole table is opening for you, but in reality Access is storing only a portion of data into memory at a time. This ensures the cost-effective use of memory and allows for more efficient data crunching on larger datasets. In addition, Access allows you to make use of Indexes that enable you to search, sort, filter, and query extremely large datasets very quickly.</p>
<p> </p>
<p><strong>Data Structure<br />
</strong></p>
<p>     If you are analyzing data that resides in a table that has no relationships with other tables, Excel is a fine choice for your analytical needs. However, if you have a series of tables that interact with each other (such as a Customers table, an Orders table, and an Invoices table), you should consider using Access. Access is a relational database, which means it is designed to handle the intricacies of interacting datasets. Some of these are the preservation of data integrity, the prevention of redundancy, and the efficient comparison and querying of data between the datasets. You will learn more about the concept of table relationships in Chapter 2.</p>
<p> </p>
<p><strong>Data Evolution<br />
</strong></p>
<p>     Excel is an ideal choice for quickly analyzing data used as a means to an end, such as a temporary dataset crunched to obtain a more valuable subset of data. The result of a pivot table is a perfect example of this kind of one-time data crunching. However, if you are building a long-term analytical process with data that has the potential of evolving and growing, Access is a better choice. Many analytical processes that start in Excel begin small and run fine, but as time passes these processes grow in both size and complexity until they reach the limits of Excel's capabilities. The message here is that you should use some foresight and consider future needs when determining which platform is best for your scenario.</p>
<p> </p>
<p><strong>Functional Complexity<br />
</strong></p>
<p>     There are far too many real-life examples of analytical projects where processes are forced into Excel even when Excel's limitations have been reached. How many times have you seen a workbook that contains an analytical process encapsulating multiple worksheets, macros, pivot tables, and formulas that add, average, count, look up, and link to other workbooks? The fact is that when Excel-based analytical processes become overly complex, they are difficult to manage, difficult to maintain, and difficult to translate to others. Consider using Access for projects that have complex, multiple-step analytical processes.</p>
<p> </p>
<p><strong>Shared Processing<br />
</strong></p>
<p>     Although it is possible to have multiple users work on one central Excel spreadsheet located on a network, ask anyone who has tried to coordinate and manage a central spreadsheet how difficult and restrictive it is. Data conflicts, loss of data, locked-out users, and poor data integrity are just a few examples of some of the problems you will encounter if you try to build a multiple-user process with Excel. Consider using Access for your shared processes. Access is better suited for a shared environment for many reasons, some of which are:</p>
<ul>
<li>the ability for users to concurrently enter and update data</li>
<li>inherent protection against data conflicts</li>
<li>prevention of data redundancy</li>
<li>protection against data entry errors</li>
</ul>
<p> </p>
<p> </p>
<p><span style="font-size: 12pt; text-decoration: underline;"><strong>An Excel User's Guide to Access: Don't Panic!<br />
</strong></span></p>
<p>     Many seasoned managers, accountants, and analysts come to realize that just because something can be done in Excel does not necessarily mean Excel is the best way to do it. This is the point when they decide to open Access for the first time. When they do open Access, the first object that looks familiar to them is the Access table. In fact, Access tables look so similar to an Excel spreadsheet that most Excel users try to use tables just like a spreadsheet. However, when they realize that they can't type formulas directly into the table or duplicate most of Excel's behavior and functionality, most of them wonder just what exactly the point of using Access is.</p>
<p>     When many Excel experts find out that Access does not behave or look like Excel, they write Access off as too difficult or as taking too much time to learn. However, the reality is that many of the concepts behind how data is stored and managed in Access are those with which the user is already familiar. Any Excel user has already learned such concepts in order to perform and present complex analysis. Investing a little time up front to see just how Access can be made to work for you can save a great deal of time in automating routine data processes.</p>
<p>     Throughout this book, you will learn various techniques in which you can use Access to perform much of the data analysis you are now performing exclusively in Excel. This section is a brief introduction to Access from an Excel expert's point of view. Here, you will focus on the big-picture items in Access. If some of the Access terms mentioned here are new or not terribly familiar, be patient. They will be covered in detail as the book progresses.</p>
<p> </p>
<p><strong>Tables<br />
</strong></p>
<p>      What will undoubtedly look most familiar to you are Access tables. tables appear almost identical to spreadsheets with familiar cells, rows, and columns. However, the first time you attempt to type a formula in one of the cells, you will see that Access tables do not possess Excel's flexible, multi-purpose nature that allows any cell to take on almost any responsibility or function.</p>
<p>     The Access table is simply a place to store data, such as numbers and text. All of the analysis and number crunching happens somewhere else. This way, data will never be tied to any particular analysis or presentation. Data is in raw form, which leaves users to determine how they want to analyze or display it. Chapter 2 will help you get started with a gentle introduction to Access basics.</p>
<p> </p>
<p><strong>Queries<br />
</strong></p>
<p>     You may have heard of Access queries but have never been able to relate to them.  Consider this: In Excel, when you use AutoFilter, a VLookup formula, or Subtotals, you are essentially running a query. A query is a question you pose against your data in order to get an answer or a result. The answer to a query can be a single data item, a Yes/No answer, or many rows of data. In Excel, the concept of querying data is a bit nebulous, as it can take the form of the different functionalities, such as formulas, AutoFilters, and Pivottables.</p>
<p>     In Access, a query is an actual object that has its own functionalities. A query is separate from a table, ensuring that data is never tied to any particular analysis. You will cover queries extensively in subsequent chapters. Your success in using Microsoft Access to enhance your data analysis will depend on your ability to create all manners of both simple and complex queries.  Chapter 3 begins your full emersion into all the functionality you can get from Access queries.</p>
<p> </p>
<p><strong>Reports<br />
</strong></p>
<p>     Access reports are an incredibly powerful component of Microsoft Access, which allow data to be presented in a variety of styles. Access reports, in and of themselves, provide an excellent illustration of one of the main points of this book: Data should be separate from analysis and presentation. The report serves as the presentation layer for a database, displaying various views into the data within. Acting as the presentation layer for your database, reports are inherently disconnected from the way your data is stored and structured. As long as the report receives the data it requires in order to accurately and cleanly present its information, it will not care where the information comes from.</p>
<p>     Access reports can have mixed reputations. On one hand, they can provide clean-looking PDF-esque reports that are ideal for invoices and form letters. On the other hand, Access reports are not ideal for showing the one-shot displays of data that Excel can provide. However, Access reports can easily be configured to prepare all manners of report styles, such as crosstabs, matrices, tabular layouts, and subtotaled layouts. You'll explore all the reporting options available to you starting in Chapter 11.</p>
<p> </p>
<p><strong>Macros and VBA<br />
</strong></p>
<p>     Just as Excel has macro and VBA functionality, Microsoft Access has its equivalents. This is where the true power and flexibility of Microsoft Access data analysis resides. Whether you are using them in custom functions, batch analysis, or automation, macros and VBA can add a customized flexibility that is hard to match using any other means. For example, you can use macros and VBA to automatically perform redundant analyses and recurring analytical processes, leaving you free to work on other tasks. Macros and VBA also allow you to reduce the chance of human error and to ensure that analyses are preformed the same way every time. Starting in Chapter 9, you will explore the benefits of macros and VBA and how you can leverage them to schedule and run batch analysis.</p>
<p> </p>
<p> </p>
<p><span style="font-size: 12pt; text-decoration: underline;"><strong>Summary<br />
</strong></span></p>
<p>     Although Excel is considered the premier tool for data analysis, Excel has some inherent characteristics that often lead to issues revolving around scalability, transparency of analytic processes, and confusion between data and presentation. Access has a suite of analytical tools that can help you avoid many of the issues that arise from Excel.</p>
<p>     First, Access can handle very large datasets and has no predetermined row limitation. This allows for the management and analysis of large datasets without the scalability issues that plague Excel. Access also forces transparency the separation of data and presentation by separating data into functional objects (that is, tables, queries, and reports) and by applying stringent rules that protect against bad processes and poor habits.</p>
<p>     As you go through this book, it is important to remember that your goal is not avoid Excel altogether but rather to broaden your toolset and to understand that, often, Access offers functionality that both enhances your analytical processes and makes your life easier.</p>
]]></content:encoded>
			<wfw:commentRss>http://datapigtechnologies.com/blog/index.php/the-case-for-access/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
		<item>
		<title>Avoiding Data Cut-Off in Excel</title>
		<link>http://datapigtechnologies.com/blog/index.php/avoiding-data-cut-off-in-excel/</link>
		<comments>http://datapigtechnologies.com/blog/index.php/avoiding-data-cut-off-in-excel/#comments</comments>
		<pubDate>Wed, 03 Feb 2010 14:30:32 +0000</pubDate>
		<dc:creator>datapig</dc:creator>
				<category><![CDATA[Access Tips and Tricks]]></category>
		<category><![CDATA[Excel & Access Integration]]></category>
		<category><![CDATA[Excel Tips and Tricks]]></category>
		<category><![CDATA[Access]]></category>
		<category><![CDATA[Excel]]></category>
		<category><![CDATA[Integration]]></category>
		<category><![CDATA[Tips and Tricks]]></category>

		<guid isPermaLink="false">http://datapigtechnologies.com/blog/?p=1679</guid>
		<description><![CDATA[It's been a busy week and I've been working hard. I think I'll reward myself by writing a blog post for people I've never met. Here we go.
Let's talk about getting Access Memo Fields into Excel.
 
So you're there you are, happily copying data from this Access table to Excel. Notice the comment length here (big [...]]]></description>
			<content:encoded><![CDATA[<p>It's been a busy week and I've been working hard. I think I'll reward myself by writing a blog post for people I've never met. Here we go.</p>
<p>Let's talk about getting Access Memo Fields into Excel.</p>
<p> <span id="more-1679"></span></p>
<p>So you're there you are, happily copying data from this Access table to Excel. Notice the comment length here (big stuff).</p>
<p><img src="http://datapigtechnologies.com/blog/wp-content/uploads/2010/02/020310_1430_GettingAcce1.png" alt="" /></p>
<p> </p>
<p> </p>
<p>Then you figure out that Access is cutting off your 'comments' field at 255 characters.</p>
<p><img src="http://datapigtechnologies.com/blog/wp-content/uploads/2010/02/020310_1430_GettingAcce2.png" alt="" /></p>
<p> </p>
<p>This is because your 'comments' field is actually a Memo data type. In a field designated as a Memo field, you can enter as many characters as you like (no 255 character limit). Unfortunately, copying and pasting Memo fields into Excel will result in data that is cut off. I know…Excel can handle well over 30,000 characters in a cell. The problem is when you copy and paste from Access, Access still exports only 255 characters for backwards compatibility purposes.</p>
<p> </p>
<p>So what do you do?</p>
<p>(a) Start copying and pasting individual comments 255 characters at a time.</p>
<p>(b) Parse your comments into separate 255-character fields, then concatenate them in Excel.</p>
<p>(c) Get a job at Barnes &amp; Noble to spend your days alphabetizing books.</p>
<p>The answer is (c). </p>
<p>But just in case you can't afford to quit your job, here are a couple of methods you can use to get Access Memo fields into Excel.</p>
<p> </p>
<p><span style="font-size:12pt"><strong>Method 1: Use the Export with Formatting Option<br />
</strong></span></p>
<p>Right click on your table and choose to export it.</p>
<p><img src="http://datapigtechnologies.com/blog/wp-content/uploads/2010/02/020310_1430_GettingAcce3.png" alt="" /></p>
<p> </p>
<p>When choosing an output, be sure to select the 'Export data with formatting and layout' option.</p>
<p><img src="http://datapigtechnologies.com/blog/wp-content/uploads/2010/02/020310_1430_GettingAcce4.png" alt="" /></p>
<p> </p>
<p> </p>
<p><span style="font-size:12pt"><strong>Method 2: Use a TransferSpreadsheet Macro<br />
</strong></span></p>
<p>You can also create a Macro to use the TransferSpreadsheet action. Using this action will bypass Access' tendency to cut data off to 255 characters.</p>
<p>As you can see, you'll have to identify the source table, and the destination path.</p>
<p> </p>
<p><img src="http://datapigtechnologies.com/blog/wp-content/uploads/2010/02/020310_1430_GettingAcce5.png" alt="" /><strong><br />
</strong></p>
<p> </p>
<p> </p>
<p>There you have it. Now if you'll excuse me, I've got to go get ready for my Barnes &amp; Noble interview.</p>
]]></content:encoded>
			<wfw:commentRss>http://datapigtechnologies.com/blog/index.php/avoiding-data-cut-off-in-excel/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Clearing Access ImportError Tables</title>
		<link>http://datapigtechnologies.com/blog/index.php/clearing-access-importerror-tables/</link>
		<comments>http://datapigtechnologies.com/blog/index.php/clearing-access-importerror-tables/#comments</comments>
		<pubDate>Tue, 26 Jan 2010 11:09:10 +0000</pubDate>
		<dc:creator>datapig</dc:creator>
				<category><![CDATA[Access Tips and Tricks]]></category>
		<category><![CDATA[Access VBA]]></category>
		<category><![CDATA[Excel & Access Integration]]></category>
		<category><![CDATA[Access]]></category>
		<category><![CDATA[Integration]]></category>
		<category><![CDATA[Tips and Tricks]]></category>

		<guid isPermaLink="false">http://datapigtechnologies.com/blog/?p=1640</guid>
		<description><![CDATA[If you move data from Excel to Access on a regular basis, you'll know that sometimes Access can't resolve the data being imported from Excel. In these cases Access automatically creates a new table called ImportErrors..
.
The ImportErrors table is supposed to log all the data points that failed to be imported. For example, imagine I [...]]]></description>
			<content:encoded><![CDATA[<p>If you move data from Excel to Access on a regular basis, you'll know that sometimes Access can't resolve the data being imported from Excel. In these cases Access automatically creates a new table called ImportErrors.<span style="color: #ffffff;">.<br />
.<span id="more-1640"></span></span></p>
<p>The ImportErrors table is supposed to log all the data points that failed to be imported. For example, imagine I have an Excel table with two columns Customer Number and Contract Number. Each column contains numbers, but let's say some entries are "NA". When Access tries to import this table, it'll interpret the two columns as Number columns and will throw out the NA values.<span style="color: #ffffff;">.<br />
.</span></p>
<p>In a gesture of good will, Access will create an ImportError table to tell you which data points were ignored. Here's what this table looks like:</p>
<p><img src="http://datapigtechnologies.com/blog/wp-content/uploads/2010/01/012610_1108_ClearingAcc1.png" alt="" /></p>
<p> </p>
<p>Well, this is semi-useful….sometimes.</p>
<p>Often times though, the errors are legitimate and benign (like "NA" being ignored in a Number field). But Access, like an OCD Uncle, continues to push out the ImportError tables.</p>
<p>After a few imports, your database will start looking like this:</p>
<p><img src="http://datapigtechnologies.com/blog/wp-content/uploads/2010/01/012610_1108_ClearingAcc2.png" alt="" /></p>
<p> <span style="color: #ffffff;">..</span></p>
<p>If you have an automated import feed coming in every Month, you'll eventually end up with a database full of ImportError tables.<span style="color: #ffffff;">.<br />
.</span></p>
<p>Before you ask, NO there isn't a way to suppress the creation of ImportError tables.  What you can do, however, is run a procedure to delete all ImportError tables. The idea is to run this piece of code after your automated import processes. This way, your database won't be inundated with ImportError Tables.</p>
<div class="syntax_hilite">
<div id="vb-2">
<div class="vb"><span style="color: #b1b100;">Function</span> DeleteImportErrorTables<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><br />
<span style="color: #b1b100;">Dim</span> oTable <span style="color: #b1b100;">As</span> DAO.<span style="color: #66cc66;">TableDef</span></p>
<p><span style="color: #b1b100;">For</span> Each oTable In CurrentDb.<span style="color: #66cc66;">TableDefs</span><br />
<span style="color: #b1b100;">If</span> oTable.<span style="color: #b1b100;">Name</span> Like <span style="color: #ff0000;">"*ImportErrors*"</span> <span style="color: #b1b100;">Then</span><br />
CurrentDb.<span style="color: #66cc66;">TableDefs</span>.<span style="color: #66cc66;">Delete</span> oTable.<span style="color: #b1b100;">Name</span><br />
<span style="color: #b1b100;">End</span> <span style="color: #b1b100;">If</span><br />
<span style="color: #b1b100;">Next</span> oTable</p>
<p><span style="color: #b1b100;">End</span> <span style="color: #b1b100;">Function</span></div>
</div>
</div>
<p></p>
<p><span style="color: #ffffff;">.<br />
.</span><br />
So OCD Access can keep creating its ImportError tables and you can automatically blow them away. You're both happy.</p>
]]></content:encoded>
			<wfw:commentRss>http://datapigtechnologies.com/blog/index.php/clearing-access-importerror-tables/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The Benefits of a Good Technical Editor</title>
		<link>http://datapigtechnologies.com/blog/index.php/the-benefits-of-a-good-technical-editor/</link>
		<comments>http://datapigtechnologies.com/blog/index.php/the-benefits-of-a-good-technical-editor/#comments</comments>
		<pubDate>Fri, 04 Dec 2009 12:30:40 +0000</pubDate>
		<dc:creator>datapig</dc:creator>
				<category><![CDATA[Access Queries]]></category>
		<category><![CDATA[Excel & Access Integration]]></category>
		<category><![CDATA[Access]]></category>
		<category><![CDATA[Excel]]></category>
		<category><![CDATA[Integration]]></category>
		<category><![CDATA[Queries]]></category>

		<guid isPermaLink="false">http://datapigtechnologies.com/blog/?p=1353</guid>
		<description><![CDATA[I'm in the process of writing my Pulitzer worthy book "An Excel Analyst's guide to Access".  During the writing process, chapters get reviewed by a team of editors - one of which is a Technical Editor. 
The Technical Editor on this book is Dick Kusleika (Daily Dose of Excel).  Kusleika is one of the better technical [...]]]></description>
			<content:encoded><![CDATA[<p>I'm in the process of writing my Pulitzer worthy book "An Excel Analyst's guide to Access".  During the writing process, chapters get reviewed by a team of editors - one of which is a Technical Editor. </p>
<p>The Technical Editor on this book is Dick Kusleika (<a href="http://www.dailydoseofexcel.com" target="_blank">Daily Dose of Excel</a>).  Kusleika is one of the better technical editors I've worked with.  I think his accountant's detail-oriented brain lends itself nicely to tech editing. </p>
<p><strong>Quick  Joke:</strong>  Did you hear about extroverted accountant?  He looks down at <em>your</em> shoes. </p>
<p><span style="color: #ffffff;">.</span></p>
<p>During his editing, Kusleika pointed out that that the serial dates in Access actually start at December 31, 1899 (not January 1, 1900 like in Excel). </p>
<p><span id="more-1353"></span></p>
<p>In Excel, every possible date starting from January 1, 1900 is stored as a serial number. For example, January 1, 1900 is stored as 1; January 2, 1900 is stored as 2; and so on. This system of storing dates as serial numbers is commonly called the 1900 system.</p>
<p><span style="color: #ffffff;"><span style="color: #ffffff;">.</span></span></p>
<p>In Access, it's different.  </p>
<p>Run this Select Query in Access and you'll get the number 2.   </p>
<p><strong>SELECT CLng(#1/1/1900#) AS Expr1</strong></p>
<p>Apparently December 31, 1899 is 1. </p>
<p>How have I missed that?!!</p>
<p><span style="color: #ffffff;"><span style="color: #ffffff;">.</span></span></p>
<p>I'm assuming Access is different because the SQL team actually wrote the original Jet engine that Access runs on.  Their date system didn't have to be based on an old Lotus product like in Excel. </p>
<p><span style="color: #ffffff;"><span style="color: #ffffff;">.</span></span></p>
<p>I haven't quite gotten my brain around the implications of this difference between the serial dates in Excel and Access.  Is there any scenario where this difference would affect date-based analyses?</p>
]]></content:encoded>
			<wfw:commentRss>http://datapigtechnologies.com/blog/index.php/the-benefits-of-a-good-technical-editor/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Easily Move Access Query Results to Excel</title>
		<link>http://datapigtechnologies.com/blog/index.php/easily-move-access-query-results-to-excel/</link>
		<comments>http://datapigtechnologies.com/blog/index.php/easily-move-access-query-results-to-excel/#comments</comments>
		<pubDate>Thu, 19 Nov 2009 20:02:41 +0000</pubDate>
		<dc:creator>datapig</dc:creator>
				<category><![CDATA[Excel & Access Integration]]></category>
		<category><![CDATA[Access]]></category>
		<category><![CDATA[Excel]]></category>
		<category><![CDATA[Integration]]></category>
		<category><![CDATA[Queries]]></category>

		<guid isPermaLink="false">http://datapigtechnologies.com/blog/?p=1292</guid>
		<description><![CDATA[Just the other day, I saw someone run an Access Query in Office 2003. Then he selected Office Tools -&#62;Analyze with Excel.  This essentially sends the results of the Access query to Excel.
.
This if fine and dandy, but there is a slightly easier way to get the results of an Access query to Excel.
.
You don't have to even open [...]]]></description>
			<content:encoded><![CDATA[<p>Just the other day, I saw someone run an Access Query in Office 2003. Then he selected Office Tools -&gt;Analyze with Excel.  This essentially sends the results of the Access query to Excel.</p>
<p><span style="color: #ffffff;">.</span></p>
<p>This if fine and dandy, but there is a slightly easier way to get the results of an Access query to Excel.</p>
<p><span style="color: #ffffff;">.<span id="more-1292"></span></span></p>
<p>You don't have to even open the query .  Simply drag the query to the Excel spreadsheet and presto.  The query will automatically run and output the results.</p>
<p><img class="alignnone size-full wp-image-1293" title="DragQuery" src="http://datapigtechnologies.com/blog/wp-content/uploads/2009/11/DragQuery.png" alt="DragQuery" width="447" height="379" /></p>
<p><span style="color: #ffffff;">.</span></p>
<p>What about parameter queries you ask?  Well, those will run too.  Access will ask you for your parameters and the result will shoot over to Excel.</p>
<p>This works for Tables too.</p>
]]></content:encoded>
			<wfw:commentRss>http://datapigtechnologies.com/blog/index.php/easily-move-access-query-results-to-excel/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Documenting Access Queries in Excel</title>
		<link>http://datapigtechnologies.com/blog/index.php/documenting-access-queries-in-excel/</link>
		<comments>http://datapigtechnologies.com/blog/index.php/documenting-access-queries-in-excel/#comments</comments>
		<pubDate>Mon, 26 Oct 2009 08:19:58 +0000</pubDate>
		<dc:creator>datapig</dc:creator>
				<category><![CDATA[Access Queries]]></category>
		<category><![CDATA[Access VBA]]></category>
		<category><![CDATA[Excel & Access Integration]]></category>
		<category><![CDATA[Access]]></category>
		<category><![CDATA[Excel]]></category>
		<category><![CDATA[Integration]]></category>
		<category><![CDATA[Power Tips]]></category>
		<category><![CDATA[Queries]]></category>
		<category><![CDATA[VBA]]></category>

		<guid isPermaLink="false">http://datapigtechnologies.com/blog/?p=1189</guid>
		<description><![CDATA[Clients usually have this pesky need to have everything documented. As a generally lazy person, this offends my lackadaisical attitude. Nevertheless, I typically oblige, given the fact that I want them to take over the work at some point.
 
Over the years, I've rolled my own documentation tools to help in this endeavor. Today, I want [...]]]></description>
			<content:encoded><![CDATA[<p>Clients usually have this pesky need to have everything documented. As a generally lazy person, this offends my lackadaisical attitude. Nevertheless, I typically oblige, given the fact that I want them to take over the work at some point.</p>
<p> </p>
<p>Over the years, I've rolled my own documentation tools to help in this endeavor. Today, I want to share a small procedure I use to document Access queries in Excel.</p>
<p> <span id="more-1189"></span></p>
<p>Copy this code into a standard module in Access.</p>
<div class="syntax_hilite">
<div id="vb-4">
<div class="vb"><span style="color: #b1b100;">Function</span> Document_My_Queries<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><br />
<span style="color: #b1b100;">Dim</span> TempTable <span style="color: #b1b100;">As</span> DAO.<span style="color: #b1b100;">Recordset</span><br />
<span style="color: #b1b100;">Dim</span> QryDef <span style="color: #b1b100;">As</span> <span style="color: #b1b100;">QueryDef</span><br />
<span style="color: #b1b100;">Dim</span> QryName <span style="color: #b1b100;">As</span> <span style="color: #b1b100;">String</span><br />
<span style="color: #b1b100;">Dim</span> strSQL <span style="color: #b1b100;">As</span> <span style="color: #b1b100;">String</span></p>
<p><span style="color: #808080;">'Step 1: Start with a fresh QueryList table</span><br />
<span style="color: #b1b100;">On</span> <span style="color: #b1b100;">Error</span> <span style="color: #b1b100;">Resume</span> <span style="color: #b1b100;">Next</span><br />
docmd.<span style="color: #66cc66;">DeleteObject</span> acTable, <span style="color: #ff0000;">"QueryList"</span><br />
CurrentDb.<span style="color: #66cc66;">Execute</span> _<br />
<span style="color: #ff0000;">"CREATE TABLE QueryList (QueryName text(100), DateCreated Date, LastUpdated Date, SQL memo)"</span>, dbFailOnError<br />
<span style="color: #b1b100;">On</span> <span style="color: #b1b100;">Error</span> <span style="color: #b1b100;">GoTo</span> <span style="color: #cc66cc;">0</span></p>
<p><span style="color: #808080;">'Step 2: Open the QueryList table</span><br />
<span style="color: #b1b100;">Set</span> TempTable = CurrentDb.<span style="color: #66cc66;">OpenRecordset</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #ff0000;">"QueryList"</span><span style="color:#006600; font-weight:bold;">&#41;</span></p>
<p><span style="color: #808080;">'Step 3: Loop through all queries and fill the QueryList table with Query Def info</span><br />
<span style="color: #b1b100;">For</span> Each QryDef In CurrentDb.<span style="color: #66cc66;">QueryDefs</span><br />
<span style="color: #808080;">'Exclude deleted querys</span><br />
<span style="color: #b1b100;">If</span> <span style="color: #b1b100;">Left</span><span style="color:#006600; font-weight:bold;">&#40;</span>QryDef.<span style="color: #b1b100;">Name</span>, <span style="color: #cc66cc;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span> = <span style="color: #ff0000;">"~"</span> <span style="color: #b1b100;">Then</span><br />
<span style="color: #b1b100;">GoTo</span> SKIPIT<br />
<span style="color: #b1b100;">End</span> <span style="color: #b1b100;">If</span><br />
TempTable.<span style="color: #66cc66;">AddNew</span><br />
TempTable!QueryName = QryDef.<span style="color: #b1b100;">Name</span><br />
TempTable!DateCreated = QryDef.<span style="color: #66cc66;">DateCreated</span><br />
TempTable!LastUpdated = QryDef.<span style="color: #66cc66;">LastUpdated</span><br />
TempTable!SQL = QryDef.<span style="color: #66cc66;">SQL</span><br />
TempTable.<span style="color: #66cc66;">Update</span><br />
SKIPIT:<br />
<span style="color: #b1b100;">Next</span></p>
<p><span style="color: #808080;">'Step 4: Use TransferSpreadsheet to export to Excel</span><br />
docmd.<span style="color: #66cc66;">TransferSpreadsheet</span> acExport, <span style="color: #cc66cc;">8</span>, <span style="color: #ff0000;">"QueryList"</span>, _<br />
CurrentProject.<span style="color: #66cc66;">Path</span> &amp;amp; <span style="color: #ff0000;">"\MyQueries.xls"</span>, <span style="color: #b1b100;">True</span>, <span style="color: #ff0000;">""</span></p>
<p><span style="color: #b1b100;">End</span> <span style="color: #b1b100;">Function</span></div>
</div>
</div>
<p></p>
<p> </p>
<p>In Step 1, you create a fresh QueryList table. This table will hold the info about your queries. If a QueryList table already exists, it gets blown away and replaced by a fresh one.</p>
<p>In Step 2, you open the QueryList table into a recordset.</p>
<p>In Step 3, you loop through all the queries in the database (skipping the ghost queries that start with ~) and you log the needed info into the QueryList table.</p>
<p>In Step 4, you use the TransferSpreadsheet method to send the QueryList table to Excel. TransferSpreadsheet will allow the ultra-long SQL statements to survive Excel's 255 character limit for a cell. Meaning, the SQL statements won't be cut off at 255 characters.<br />
The workbook will be saved into a file called MyQueries.xls in the same directory as the host database.</p>
<p> </p>
<p>Here's what the final spreadsheet looks like.</p>
<p><img src="http://datapigtechnologies.com/blog/wp-content/uploads/2009/10/102609_0819_Documenting1.png" alt="" /></p>
<p>Why send this info to Excel?  I find that an Excel workbook makes for a nice documentation file, allowing me to partition different aspects of my documentation into tabs.  Queries on one tab, Tables on one tab, Forms on one tab, etc.  </p>
<p>Outside of documentation, you can also use this to essentially create a backup of the queries in your database.</p>
]]></content:encoded>
			<wfw:commentRss>http://datapigtechnologies.com/blog/index.php/documenting-access-queries-in-excel/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Running an Access Parameter Query from Excel</title>
		<link>http://datapigtechnologies.com/blog/index.php/running-an-access-parameter-query-from-excel/</link>
		<comments>http://datapigtechnologies.com/blog/index.php/running-an-access-parameter-query-from-excel/#comments</comments>
		<pubDate>Mon, 19 Oct 2009 09:46:46 +0000</pubDate>
		<dc:creator>datapig</dc:creator>
				<category><![CDATA[Access Queries]]></category>
		<category><![CDATA[Excel & Access Integration]]></category>
		<category><![CDATA[Excel VBA]]></category>
		<category><![CDATA[MS Query]]></category>
		<category><![CDATA[Access]]></category>
		<category><![CDATA[Excel]]></category>
		<category><![CDATA[Integration]]></category>
		<category><![CDATA[Queries]]></category>
		<category><![CDATA[VBA]]></category>

		<guid isPermaLink="false">http://datapigtechnologies.com/blog/?p=1148</guid>
		<description><![CDATA[An Access parameter query is a kind of interactive query that prompts you for criteria before the query is run. Parameter queries are useful when you need to ask the query different questions using different criteria each time you run it.
Now we all know you can pull data from Access into Excel using MS Query. [...]]]></description>
			<content:encoded><![CDATA[<p>An Access parameter query is a kind of interactive query that prompts you for criteria before the query is run. Parameter queries are useful when you need to ask the query different questions using different criteria each time you run it.</p>
<p>Now we all know you can pull data from Access into Excel using MS Query. The problem is that MS Query doesn't let you pull in Parameter queries. There may be a technical reason for this, but I like to think it's just Microsoft's way of keeping things interesting. After all, technical roadblocks <span style="text-decoration: underline;">are</span> the spice of life.<br />
If you've had enough spice, I'll show you a VBA workaround that will enable you to run an Access parameter query from Excel.</p>
<p> <span id="more-1148"></span></p>
<p><span style="font-size:14pt"><strong>The Problem:<br />
</strong></span></p>
<p>I've built this parameter query in Accesss. This particular query will ask the user for a Region and a Business Segment. This works fine in Access.</p>
<p>I've named this query <strong>MyParameterQuery</strong>.</p>
<p><img src="http://datapigtechnologies.com/blog/wp-content/uploads/2009/10/101909_0945_RunninganAc1.png" alt="" /></p>
<p> </p>
<p>The problem is when I try to connect to this query via MS Query in Excel, I don't see it in the list. It turns out that Parameter queries are not available in list of connectable objects.</p>
<p><img src="http://datapigtechnologies.com/blog/wp-content/uploads/2009/10/101909_0945_RunninganAc2.png" alt="" /></p>
<p> </p>
<p>Even if I try to get cocky, brute forcing MS Query to look at the query, I get the dreaded "Too Few Parameters" error.</p>
<p><img src="http://datapigtechnologies.com/blog/wp-content/uploads/2009/10/101909_0945_RunninganAc3.png" alt="" /></p>
<p> </p>
<p> </p>
<p><span style="font-size:14pt"><strong>The Solution:<br />
</strong></span></p>
<p>My solution is to use a bit of VBA to pull the data based on parameters you enter directly into Excel.</p>
<p>The first step is to set up a spreadsheet like the one shown here.  You'll notice that the needed parameters will be fed from Cells D3 and D4.</p>
<p><img src="http://datapigtechnologies.com/blog/wp-content/uploads/2009/10/101909_0945_RunninganAc4.png" alt="" /></p>
<p> </p>
<p>Once your spreadsheet is ready to go, switch over to VBA and enter this code into a standard module.</p>
<p><strong>Note: </strong>You will need to add a reference to the <strong>Microsoft DAO XX Object Library</strong> (where XX represents the latest version you have) .</p>
<p> </p>
<div class="syntax_hilite">
<div id="vb-6">
<div class="vb"><span style="color: #b1b100;">Sub</span> RunParameterQuery<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span></p>
<p><span style="color: #808080;">'Step 1: Declare your variables</span><br />
<span style="color: #b1b100;">Dim</span> MyDatabase <span style="color: #b1b100;">As</span> DAO.<span style="color: #b1b100;">Database</span><br />
<span style="color: #b1b100;">Dim</span> MyQueryDef <span style="color: #b1b100;">As</span> DAO.<span style="color: #b1b100;">QueryDef</span><br />
<span style="color: #b1b100;">Dim</span> MyRecordset <span style="color: #b1b100;">As</span> DAO.<span style="color: #b1b100;">Recordset</span><br />
<span style="color: #b1b100;">Dim</span> i <span style="color: #b1b100;">As</span> <span style="color: #b1b100;">Integer</span></p>
<p><span style="color: #808080;">'Step 2: Identify the database and query</span><br />
<span style="color: #b1b100;">Set</span> MyDatabase = DBEngine.<span style="color: #66cc66;">OpenDatabase</span> _<br />
<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #ff0000;">"C:\Integration\IntegrationDatabase.accdb"</span><span style="color:#006600; font-weight:bold;">&#41;</span><br />
<span style="color: #b1b100;">Set</span> MyQueryDef = MyDatabase.<span style="color: #66cc66;">QueryDefs</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #ff0000;">"MyParameterQuery"</span><span style="color:#006600; font-weight:bold;">&#41;</span></p>
<p><span style="color: #808080;">'Step 3: Define the Parameters</span><br />
<span style="color: #b1b100;">With</span> MyQueryDef<br />
.<span style="color: #66cc66;">Parameters</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #ff0000;">"[Enter Segment]"</span><span style="color:#006600; font-weight:bold;">&#41;</span> = Range<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #ff0000;">"D3"</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color: #66cc66;">Value</span><br />
.<span style="color: #66cc66;">Parameters</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #ff0000;">"[Enter Region]"</span><span style="color:#006600; font-weight:bold;">&#41;</span> = Range<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #ff0000;">"D4"</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color: #66cc66;">Value</span><br />
<span style="color: #b1b100;">End</span> <span style="color: #b1b100;">With</span></p>
<p><span style="color: #808080;">'Step 4: Open the query</span><br />
<span style="color: #b1b100;">Set</span> MyRecordset = MyQueryDef.<span style="color: #66cc66;">OpenRecordset</span></p>
<p><span style="color: #808080;">'Step 5: Clear previous contents</span><br />
Sheets<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #ff0000;">"Main"</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color: #66cc66;">Select</span><br />
ActiveSheet.<span style="color: #66cc66;">Range</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #ff0000;">"A6:K10000"</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color: #66cc66;">ClearContents</span></p>
<p><span style="color: #808080;">'Step 6: Copy the recordset to Excel</span><br />
ActiveSheet.<span style="color: #66cc66;">Range</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #ff0000;">"A7"</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color: #66cc66;">CopyFromRecordset</span> MyRecordset</p>
<p><span style="color: #808080;">'Step 7: Add column heading names to the spreadsheet</span><br />
<span style="color: #b1b100;">For</span> i = <span style="color: #cc66cc;">1</span> <span style="color: #b1b100;">To</span> MyRecordset.<span style="color: #66cc66;">Fields</span>.<span style="color: #b1b100;">Count</span><br />
ActiveSheet.<span style="color: #66cc66;">Cells</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #cc66cc;">6</span>, i<span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color: #66cc66;">Value</span> = MyRecordset.<span style="color: #66cc66;">Fields</span><span style="color:#006600; font-weight:bold;">&#40;</span>i - <span style="color: #cc66cc;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color: #b1b100;">Name</span><br />
<span style="color: #b1b100;">Next</span> i</p>
<p><span style="color: #b1b100;">MsgBox</span> <span style="color: #ff0000;">"Your Query has been Run"</span></p>
<p><span style="color: #b1b100;">End</span> <span style="color: #b1b100;">Sub</span></div>
</div>
</div>
<p></p>
<p> </p>
<p>After the code is ready, running it will make data magically appear based on your parameters!</p>
<p>Who needs MS Query?</p>
<p><img src="http://datapigtechnologies.com/blog/wp-content/uploads/2009/10/101909_0945_RunninganAc5.png" alt="" /></p>
<p> </p>
<p>This technique allows you to build some interesting reporting solutions with relatively little effort.</p>
]]></content:encoded>
			<wfw:commentRss>http://datapigtechnologies.com/blog/index.php/running-an-access-parameter-query-from-excel/feed/</wfw:commentRss>
		<slash:comments>44</slash:comments>
		</item>
		<item>
		<title>Sending Variable Access Data To An Excel Range</title>
		<link>http://datapigtechnologies.com/blog/index.php/sending-variable-access-data-to-an-excel-range/</link>
		<comments>http://datapigtechnologies.com/blog/index.php/sending-variable-access-data-to-an-excel-range/#comments</comments>
		<pubDate>Mon, 28 Sep 2009 15:50:54 +0000</pubDate>
		<dc:creator>datapig</dc:creator>
				<category><![CDATA[Excel & Access Integration]]></category>
		<category><![CDATA[Access]]></category>
		<category><![CDATA[Excel]]></category>
		<category><![CDATA[Integration]]></category>

		<guid isPermaLink="false">http://datapigtechnologies.com/blog/?p=1025</guid>
		<description><![CDATA[Today, I 'd like to show you a nifty trick that will allow you to send Variable length tables from Access to a specific Excel Range without code.
That's right, I said without any VBA coding. I know you're as excited as I am, so here we go.

The Proposal:

I have a model where my table feeds [...]]]></description>
			<content:encoded><![CDATA[<p>Today, I 'd like to show you a nifty trick that will allow you to send Variable length tables from Access to a specific Excel Range without code.</p>
<p>That's right, I said without any VBA coding. I know you're as excited as I am, so here we go.</p>
<p><span id="more-1025"></span></p>
<p><span style="font-size:14pt"><strong>The Proposal:<br />
</strong></span></p>
<p>I have a model where my table feeds a chart. Right now, the data in this table is hard coded and static. However, the data actually comes from an Access Query.</p>
<p>My proposal is to have an Access application that sends data to Excel dynamically.  This way, I can have my Access application output an Excel report.  That being said, I'd like to have Access be able to automatically send the data to the correct range.</p>
<p><img src="http://datapigtechnologies.com/blog/wp-content/uploads/2009/09/092809_1549_SendingVari1.png" alt="" /></p>
<p><span style="font-size:14pt"><strong>Step 1: Create a Named Range<br />
</strong></span></p>
<p>The first step is to create a named range where I can point Access to. In this example, I'm going to specify my column headers as the named range. No, I'm not crazy. This range will automatically shrink and grow with data, so there is no need to specify any more than the headers. Note that I called my range ChartData.</p>
<p><img src="http://datapigtechnologies.com/blog/wp-content/uploads/2009/09/092809_1549_SendingVari2.png" alt="" /></p>
<p><span style="font-size:14pt"><strong>Step 2: Step up the Query<br />
</strong></span></p>
<p>In this example, I'm using a query that gives me the sum of revenue by period. You can use a table if you'd like. The idea is that you set up an object that holds the data to be transferred. In this example, my query is called 'SumByPeriod'.</p>
<p><img src="http://datapigtechnologies.com/blog/wp-content/uploads/2009/09/092809_1549_SendingVari3.png" alt="" /></p>
<p><span style="font-size:14pt"><strong>Step 3: Step up the Transfer Macro<br />
</strong></span></p>
<p>Create a new macro that will use the TranferSpreadsheet action to transfer the data from the specified query to the named range.</p>
<p>Here, I'm telling Access to export data from the SumByPeriod query to the ChartData range.</p>
<p>Note that you'll have to explicitly define the location of the workbook that holds the named range. This will work wether the workbook is open or closed.</p>
<p><img src="http://datapigtechnologies.com/blog/wp-content/uploads/2009/09/092809_1549_SendingVari4.png" alt="" /></p>
<p><span style="font-size:14pt"><strong>The Result<br />
</strong></span></p>
<p>Once you save your macro, you can run it. After running my macro, you'll see that the data was sent to Excel exactly where I wanted it. Notice that he range has automatically expanded to fit the data. <img src="http://datapigtechnologies.com/blog/wp-content/uploads/2009/09/092809_1549_SendingVari5.png" alt="" /></p>
<p>If I add more data to the query and run the macro again, my ChartData range will expand to fit the added data.</p>
<p><img src="http://datapigtechnologies.com/blog/wp-content/uploads/2009/09/092809_1549_SendingVari6.png" alt="" /></p>
<p>Here's the nifty bit. If I reduce the amount of data going out, my ChartData range will contract to fit only the transferred data.</p>
<p><img src="http://datapigtechnologies.com/blog/wp-content/uploads/2009/09/092809_1549_SendingVari7.png" alt="" /></p>
<p><img src="http://datapigtechnologies.com/blog/wp-content/uploads/2009/09/092809_1549_SendingVari8.png" alt="" /></p>
]]></content:encoded>
			<wfw:commentRss>http://datapigtechnologies.com/blog/index.php/sending-variable-access-data-to-an-excel-range/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Passing Multiple Values to One Parameter</title>
		<link>http://datapigtechnologies.com/blog/index.php/passing-multiple-values-to-one-parameter/</link>
		<comments>http://datapigtechnologies.com/blog/index.php/passing-multiple-values-to-one-parameter/#comments</comments>
		<pubDate>Wed, 05 Aug 2009 06:05:31 +0000</pubDate>
		<dc:creator>datapig</dc:creator>
				<category><![CDATA[Excel & Access Integration]]></category>
		<category><![CDATA[MS Query]]></category>
		<category><![CDATA[Excel]]></category>
		<category><![CDATA[Integration]]></category>
		<category><![CDATA[Power Tips]]></category>

		<guid isPermaLink="false">http://datapigtechnologies.com/blog/?p=675</guid>
		<description><![CDATA[I often use MS Query to pull external data into Excel. I find it to be an extremely powerful way to quickly pull together interactive reporting without a lot of effort. If you're new to MS Query, you may want to check out Kusleika's intro to MS Query to get the gist.
.
Anyway, one of the [...]]]></description>
			<content:encoded><![CDATA[<p>I often use MS Query to pull external data into Excel. I find it to be an extremely powerful way to quickly pull together interactive reporting without a lot of effort. If you're new to MS Query, you may want to check out <a href="http://www.dicks-clicks.com/excel/ExternalData.htm" target="_blank">Kusleika's intro to MS Query</a> to get the gist.</p>
<p><span style="color: #ffffff;">.</span></p>
<p>Anyway, one of the more common requests I get is to allow a user to dynamically pass multiple criteria to a parameter. For example, a manager may want to pull in data for Tulsa, and Dallas, and Seattle at the same time.<br />
<span id="more-675"></span></p>
<p><span style="color: #ffffff;">.</span></p>
<p>In this example, I've built a model where a user can use a Multi-select Listbox to choose Markets. The MS Query responds accordingly to bring back the chosen Markets.</p>
<p><img src="http://datapigtechnologies.com/blog/wp-content/uploads/2009/08/080509_0605_PassingMult1.png" alt="" /></p>
<p><span style="color: #ffffff;">.</span></p>
<p>The selection of different Markets brings back another set of data.</p>
<p><img src="http://datapigtechnologies.com/blog/wp-content/uploads/2009/08/080509_0605_PassingMult2.png" alt="" /></p>
<p><span style="color: #ffffff;">.</span></p>
<p>What's interesting about this is that I only have one parameter built into my MS Query connection. That's right; I'm passing multiple markets to one parameter.</p>
<p>Here's how it's done:</p>
<p><span style="color: #ffffff;">.</span></p>
<p><strong>Step 1: Build a basic MS Query connection without any parameters<br />
</strong></p>
<p>Here, I've built a query that gives me all Markets.</p>
<p><img src="http://datapigtechnologies.com/blog/wp-content/uploads/2009/08/080509_0605_PassingMult3.png" alt="" /></p>
<p><span style="color: #ffffff;">.</span></p>
<p><strong>Step 2: Right-click anywhere inside the query table and select External Data Properties<br />
</strong></p>
<p><img src="http://datapigtechnologies.com/blog/wp-content/uploads/2009/08/080509_0605_PassingMult4.png" alt="" /></p>
<p><span style="color: #ffffff;">.</span></p>
<p><strong>Step 3: Click Connection Properties<br />
</strong></p>
<p><img src="http://datapigtechnologies.com/blog/wp-content/uploads/2009/08/080509_0605_PassingMult5.png" alt="" /></p>
<p><span style="color: #ffffff;">.</span></p>
<p><strong>Step 4: Add a WHERE clause that passes a parameter through an Instr function<br />
</strong></p>
<p>The Instr function is designed to find the occurrence of a string within another string, returning the position number for the string you are trying to find.</p>
<p>The basic syntax is Instr(String to Search, String to Find)</p>
<p>In this example, I am using <strong>Instr(?, [Market])</strong>. This will evaluate each market to see if it is found in the parameter I am passing.</p>
<p>So if I literally pass multiple markets to my parameter separated by commas, (for example; "Denver, Tulsa, California"), all matching markets will evaluate to a position number greater than zero.</p>
<p><span style="color: #ffffff;">.</span></p>
<p>The long and short of it is that a WHERE clause is added to the query that will only return records where the Market field evaluates to a position number greater than zero when thrown against my parameter. Thus:</p>
<p><strong>WHERE (Instr(?, [Market])&gt;0)<br />
</strong></p>
<p><img src="http://datapigtechnologies.com/blog/wp-content/uploads/2009/08/080509_0605_PassingMult6.png" alt="" /></p>
<p><span style="color: #ffffff;">.</span></p>
<p><strong>Step 5: Set up your parameter to use a cell reference for future refreshes<br />
</strong></p>
<p>In this example, I'm telling my query to get the parameter values from cell A1<strong><br />
</strong></p>
<p><img src="http://datapigtechnologies.com/blog/wp-content/uploads/2009/08/080509_0605_PassingMult7.png" alt="" /></p>
<p><span style="color: #ffffff;">.</span></p>
<p>Once that is set up, any value placed in Cell A1 will trigger the MS Query to refresh.</p>
<p><img src="http://datapigtechnologies.com/blog/wp-content/uploads/2009/08/080509_0605_PassingMult8.png" alt="" /></p>
<p><span style="color: #ffffff;">.</span></p>
<p>And because of our cool Instr function, we can request multiple markets in that one parameter.</p>
<p><img src="http://datapigtechnologies.com/blog/wp-content/uploads/2009/08/080509_0605_PassingMult9.png" alt="" /></p>
<p><span style="color: #ffffff;">.</span></p>
<p><span style="font-size:14pt"><strong>Setting up the Multi-Select ListBox<br />
</strong></span></p>
<p>If you want to get fancy, you can add an ActiveX Listbox and configure it to be multi-select.</p>
<p><img src="http://datapigtechnologies.com/blog/wp-content/uploads/2009/08/080509_0605_PassingMult10.png" alt="" /></p>
<p><img src="http://datapigtechnologies.com/blog/wp-content/uploads/2009/08/080509_0605_PassingMult11.png" alt="" /></p>
<p><span style="color: #ffffff;">.</span></p>
<p>Once you have your Listbox set up, you'll have to use a bit of code to pass the selected items to cell A1 ( the trigger for the query table).</p>
<div class="syntax_hilite">
<div id="vb-8">
<div class="vb"><span style="color: #b1b100;">Private</span> <span style="color: #b1b100;">Sub</span> ListBox1_Change<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><br />
<span style="color: #b1b100;">Dim</span> lItem <span style="color: #b1b100;">As</span> <span style="color: #b1b100;">Long</span><br />
<span style="color: #b1b100;">Dim</span> strSelected <span style="color: #b1b100;">As</span> <span style="color: #b1b100;">String</span></p>
<p><span style="color: #b1b100;">For</span> lItem = <span style="color: #cc66cc;">0</span> <span style="color: #b1b100;">To</span> ListBox1.<span style="color: #66cc66;">ListCount</span> - <span style="color: #cc66cc;">1</span><br />
<span style="color: #b1b100;">If</span> ListBox1.<span style="color: #66cc66;">Selected</span><span style="color:#006600; font-weight:bold;">&#40;</span>lItem<span style="color:#006600; font-weight:bold;">&#41;</span> = <span style="color: #b1b100;">True</span> <span style="color: #b1b100;">Then</span><br />
strSelected = strSelected &amp; ListBox1.<span style="color: #66cc66;">List</span><span style="color:#006600; font-weight:bold;">&#40;</span>lItem<span style="color:#006600; font-weight:bold;">&#41;</span> &amp; <span style="color: #ff0000;">", "</span><br />
<span style="color: #b1b100;">End</span> <span style="color: #b1b100;">If</span><br />
<span style="color: #b1b100;">Next</span> lItem</p>
<p><span style="color: #808080;">'Update the trigger cell</span><br />
Range<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #ff0000;">"A1"</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color: #66cc66;">Value</span> = strSelected</p>
<p><span style="color: #808080;">'Refresh the query table</span><br />
ActiveSheet.<span style="color: #66cc66;">QueryTables</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #ff0000;">"Query from MS Access Database"</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color: #66cc66;">Refresh</span> <span style="color: #b1b100;">False</span></p>
<p><span style="color: #b1b100;">End</span> <span style="color: #b1b100;">Sub</span></div>
</div>
</div>
<p></p>
<p><span style="color: #ffffff;">.</span></p>
<p><span style="font-size:14pt"><strong>Excel 2003</strong></span></p>
<p>You’ll notice that I’ve conspicuously not mentioned Excel 2003 yet.  Well this technique gets complicated in Excel 2003 - for a few reasons.</p>
<p>First, there is no easy way to change the SQL statement after the MS Query is built in Excel 2003.  You can do it via VBA, but it’s not practical enough to try to describe it here.</p>
<p>Second, MS Query has a conniption when you try to add the fancy Instr parameter in the MS Query Interface.  I’ve only been able to apply this technique by changing the SQL outside of MS Query.</p>
<p>Hopefully someone will suggest some obvious solution for Excel 2003 that I haven’t been able to find.</p>
<p><span style="color: #ffffff;">.</span></p>
<p><strong>*****UPDATE*****</strong></p>
<p>Dick Kusleika and Jan Karl Pieterse developed an add-in that enables the editing of SQL statements in Excel 2003!  You can get it at <a onclick="javascript:pageTracker._trackPageview('/outbound/comment/www.jkp-ads.com');" rel="nofollow" href="http://www.jkp-ads.com/download.asp">http://www.jkp-ads.com/download.asp</a>.  The add-in is called QueryManager.  With this add-in, you can employ this technique without fighting MSQuery.</p>
]]></content:encoded>
			<wfw:commentRss>http://datapigtechnologies.com/blog/index.php/passing-multiple-values-to-one-parameter/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
	</channel>
</rss>
