Tuesday, May 29, 2012

MS Access - A Cost Effective, Powerful Business Tool

MS Access is a powerful low-cost business tool that offers excellent ROI and fills many and varied business needs. 

As the most popular database program in the world, MS Access allows the creation of very sophisticated multi-user applications with a shared back-end data source, simple desktop data manipulation, or adhoc reporting solutions from a variety of data sources.  

I have not found a data source that I could not link MS Access to including SQL Server, Oracle, MySQL, MS Excel, Word, dBase, etc.  Because of this, an Access developer has the ability to develop and deploy real-time front-end solutions that report critical business intelligence from one or more of these sources.  These solutions can either be one-offs or custom menu-driven applications that offer the selection of multiple criteria, grouping, sorting and visual representation. 

With the Access Query Designer, complex multi-table queries can be created. Queries can also use VBA or user defined functions directly in queries for sophisticated analysis and updates.

The reporting ability in MS Access ranges from simple data querying to complex grouped, sorted and summarized reports with charts, graphs and custom VBA functions.  Include sub-reports to further show multi-table relationships if needed.  Here's a few examples:





MS Access 2010 also includes the ability to design and deploy database applications to web hosted Sharepoint sites.  These can be totally browser based or desktop front-ends linked to Sharepoint lists.  Though there are size limitations, this allows the flexibility to have remote users share, add or update all or some business data.  Note the example of Sharepoint hosted reporting design:


Bottom Line Cost Advantage

MS Access offers a low-cost solution for handling data and automating business processes.  Microsoft even makes available a free runtime that alleviates the cost of buying Access for every end user. 
For many business needs, MS Access is a cost-effective and powerful tool!

Wednesday, May 2, 2012

MS Access Key From Image

I wanted to share an additional option to my earlier blog regarding Sharepoint Attachments.  This design shows the flexibility that can be built into an MS Access Web Database.

Here it is:

In my web database (as described in my blog "MS Access SharePoint Attachment Field):

Add CLIENT forms that have an unbound Image Control, place TIF images in a consistent folder on the users computer (I would automate the daily image distribution).

Run my custom PopulateImages() function that adds the image names to a field in the table.

In the OnCurrent event of the form, set the unbound image control's "Picture" to the image.

As my tables are still Sharepoint lists, I still have the administrative advantages of a web database. This is more reasonable for higher daily volumes (remember it took and hour to add 150 images to the attachment field). It also gives the advantage of distributing any updates to users automatically whenever they login. Users can use the free MS Access 2010 runtime. Either browser based or client based can be available from the same application.

Private Sub Form_Current()
Dim MImage
MImage = "C:\folder\NewImages\" & Me.ImageName
Me.ImageNew.Picture = MImage
End Sub

What do you think?

Sunday, April 29, 2012

MS Access to Oracle ODBC Connection

I recently had an adhoc reporting project using MS Access querying Oracle tables via ODBC. Thought I would share the process for anyone that might need it.

Though I could make the connection read/write, for safety and because I didn't need to make any changes to the Oracle data, a read-only connection was made. Here's the basic overview:

Oracle provides a free local client (Instant Client) and ODBC driver that is used for the connection. It can be downloaded from:

http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html

It's important to select the correct driver - either 32 or 64 bit. The Oracle documentation doesn't clearly explain but keep in mind that you want the driver version to match your Oracle server version. I used the 32-bit version. After downloading and installing the Oracle "Instant Client" (make sure to download the separate ODBC driver that is part of the Instant Client), you must setup your system PATH and TNS_ADMIN variable as follows:

• In Windows explorer LEFT pane, right click on “My Computer” icon and click “Properties”



• Click “Advanced system settings” tab

• Click Environment variables button:

• In the “System Variables” panel select “Path” variable and click “Edit” button:

• Now find a variable called TNS_ADMIN — it could be in either System or User panel (I chose System so that all users on this PC would have access), if you have no such variable, create it in the User panel by clicking “New”:

• Variable Name: TNS_ADMIN

• Variable Value: C:\InstantClient (or whatever folder you designated in the install above)

• Click Ok

• Now click “Ok” on the Environment Variables screen and click “Ok” on the System Properties window to close it

• Run C:\InstantClient\odbc_install to install the Oracle ODBC driver.

• Run the ODBC Data Source Administrator to configure your connection. Note: The default ODBC
Data Source Administrator is 64-bit so if you are running the 32-bit ODBC driver, you will have to specifically run the above file (on my machine it was found at (C:\Windows\SysWOW64\odbcad32.exe).

• Select “System DSN” and configure as shown:

• Click “Test Connection” to confirm set-up. You will be asked for a TNS Service Name, User ID and password which your Oracle administrator can give you. If all is correct you should see a successful connection message.



Once connected, I was able to design and run all my reports without issue.

MS Access SharePoint Attachment Field

I recently tested a project that is a good candidate for MS Access on Sharepoint. It is an ongoing project keying records daily from scanned images and would require at least 3 keyers daily. The advantages are obvious: ability to work remotely, centralized administration, and flexibility to distribute or redistribute work flow.

I developed forms with needed validation rules for each unique image that we are keying from. Within the table design (and then forms) I included an attachment field. When an attachment field is added to a form, the first image will show. As I will only add one image per record, this works perfectly for our purpose.

For management tools, I designed a separate, client application that links to the Sharepoint lists (tables). I run daily processes and updates from this "management" application. I needed a way to add all new images in a batch process daily. My images arrive as tifs since this is the default and best format on scanning images. However, this format is not "web enabled" and needed to be converted to jpg's to render in the browser. After batch converting the tif's to jpg's, I batch add them to the table with the following two-step vba functions: First, I populate a field in the table (list) with the name of the image (having all new images in a folder):

Public Function PopulateImages()
Dim strFile As String
Dim strFolder As String
Dim strSQL As String

strFolder = "C:\Folder\NewImages\"
strFile = Dir$(strFolder & "*.jpg")

Do While Len(strFile) > 0
strSQL = "INSERT INTO TicketsTbl (ImageName) " & "VALUES(" & Chr$(34) & strFile & Chr$(34) & ")"
CurrentDb.Execute strSQL, dbFailOnError
strFile = Dir$()
Loop
End Function

Then I add the attachments:

Sub AddAttachments()
Dim mfile
Set db = CurrentDb
Dim rsTickets As DAO.Recordset

Set rsTickets = db.OpenRecordset("TicketsTbl")

If Not (rsTickets.EOF And rsTickets.BOF) Then
rsTickets.MoveFirst
Do Until rsTickets.EOF
rsTickets.Edit
Set rsPictures = rsTickets.Fields("Field1").Value
mfile = rsTickets.Fields("ImageName")
mfile = "C:\Folder\1F\" & mfile

rsPictures.AddNew
rsPictures.Fields("FileData").LoadFromFile mfile
rsPictures.Update

rsTickets.Update
rsTickets.MoveNext

Loop
End If

Set rsTickets = Nothing
Set db = Nothing

End Sub

NOTE: I set the process running and checked back later and found that adding 150 jpg attachments took one hour. Not real speedy and an obvious consideration that will make this process unreasonable for some projects.

I have the ability to run counts, do quality control and give feedback to keyers based on the login information that Sharepoint always captures. The built in fields are "SharePointCreatedDate", "Author", "SharePointModifiedDate" and "SharePointEditor." I always add similar fields to my desktop applications but these are included in any SharePoint list.

I found no fully-developed instructions to this process on the web (though I started with a basic outline of the add attachment function from Microsoft) so I'm hopeful that this information will be helpful to some of you. Would love to hear your feedback.

Sunday, November 6, 2011

Sharepoint Access Services Reporting Flexibility

I have been struggling with offering my users a flexible and powerful reporting environment in their Access Services application. In a desktop MS Access database, to give users the ability to select more than one item to apply to a single filtering criteria you can either create a custom interface/fuction with VBA or use a multi-select combobox (or listbox) with VBA. Unfortunately, VBA is not available in Access Services. Microsoft has replaced VBA with expanded Macro capabilities that, while pretty powerful, is not as flexible or powerful as VBA. Nor is a multi-select combobox available in the same way in a web database. I had to think outside the box.

Here's what I came up with:

In our database we have a table with contacts and a related table with lists that the contacts belong to. I created a list lookup table with the values the users can select to filter their records with the fields: SelectList(s) (Y/N), Lists, ListID. There are 55 possible lists in the lookup table. Then I designed a report selection form, placed a subform on it with checkboxes for each list selection. After selecting the list(s) the user desires and clicking "Select Lists" a macro is run that populates TempVars with the for selected list(s) ListID number.

I designed a Query that links the Contacts table to an interim ContactLists table that then links to the SelectMultiLists table. I run a datamacro that sets the selected records to YES for the TempVars ListID. I included the SelectList field in the query and set it's criteria to "True" so that only the related records that the user has checked in the subform appear in the results.

Back on the Report Selection form, after the user clicks the yes/no option to select their criteria, they select the report (I have 4 different report formats including labels and a spreadsheet layout appropriate for export to Excel) they want to run and a macro is run with additional If/Else/Endif structure that additionally filters the report selected.

In this way I was able to offer reports on multiple lists and have included 3 additional criteria (state, district, active).

I reviewed the templates Microsoft offers for Web Databases, and the Northwinds Web template and I believe what I have designed has more flexibility/options for reporting all in Sharepoint (don't have to move to the client).

Would love to hear your feedback if you have worked with Access Services and can offer better or additional reporting suggestions.

Sunday, September 25, 2011

My First Access Services Project

Access Services is Microsoft's answer to running MS Access applications on the web, in Sharepoint. The obvious advantage is that a user with login credentials can access their data from any web browser. I have completed and published my first MS Access Services project. It has been tested on an iphone/ipad and it runs just like on a PC (not quite as much fun on an iphone because of the screen size but great to have the option in a pinch). I don't know about you but I can think of lots of business needs that this might fill. Microsoft Access is the most widely used desktop database system in the world. Sharepoint is the perfect intranet environment and adding Access Services extends that usefulness.

Challenges that had to be overcome:

1) Office 2010 was the first release of Access Services so finding a lot of good examples and forum support is a challenge. A Google search on any MS Access features or questions returns beaucoup of resources - such is not yet the case with Access Services. Microsoft recommends http://www.utteraccess.com/forum/Access-Services-Web-Data-f74.html and I have found others like http://accessexperts.net/blog/category/access-web-database, http://channel9.msdn.com and http://dmoffat.wordpress.com. Though there are many that try to offer support, most prefice their comments with "I haven't tried this yet, but ..." It's a start, we are all learning and any effort these non-paid folks make to help should definately be appreciated. I've found posts by Albert Kallal are very comprehensive and informative.

2) I heard a lot of buzz about the fact that you must either have Sharepoint hosted in house of pay for the hosting service. Some complained that it was too expensive. In my opinion, this is not an issue. Any serious business application on the web must be securely hosted somewhere and Sharepoint offers that security and flexibility at a reasonable price for businesses. For $49/month accesshosting.com offers 5 users and handles our needs. That is not concurrent users, concurrent users aren't limited. That 5 users is user logins. So I configured administrator, contributor and viewer users with 3 user logins to spare. Accesshosting includes a daily backup in the hosting price but will only restore back one day. This is not an adequate backup/restore flexibility for most businesses but you can upgrade backup/restore options or plan your own backup.

2) Optimizing the design for speed. As we are running this in a web browser with multiple and varied internet speeds, making it as efficient as possible is important to it being a useable tool. My project contained about 14,000 records in the largest table and initially was too slow to load. The solution was to open the main page with a subset of the data (A-C for example) and offer the user a box to search for the record(s) they want and then query the next small subset of data. Doing this in all forms made a huge different in speed.

3) Offering multiple report formats and filtering options. I have 10 reports including formatted labels, each report/label has 3 or more filtering options. I host with Accesshosting.com and they include SQL Reporting Services in the hosting. In this way, my users are able to generate their reports and print or export in multiple formats including PDF, Excel, CSV and more. Does the trick.

I'm excited about the results and looking for my next project!

Sunday, July 4, 2010

MS Access 2010 - Sharepoint Hosting

I have taken the giant step of upgradng to Microsoft Office 2010 and I love it. I did not upgrade to 2007 because I chose to wait for the second iteration of this major upgrade. For MS Access 2010, the major improvement and, in my opinion, move in the right direction, is the new Access Services that makes it possible to develop an application totally for the web and hosted on a MS Sharepoint server. Data is moving to the web, we know it and if we are smart, we will get ready to support it.

Here's how it works: In Access the developer must select "Web Database" option when starting the project. All forms, reports, Queries and events are developed with web compatibility. New macro functionality has been added to extend the capabilities. Access 2010 allows forms and reports to be published to web sites using what is called "access web services" that runs on Sharepoint software. These web based forms and reports run in any standard browser. Before publishing your project to the Sharepoint server, it is checked for compatibility and errors reported.

Many have voiced the concern that having to run in Sharepoint creates an expense and complication that will impede this usefulness. Honestly, I had this concern at first but here's what I decided: Any URL will have to be hosted somewhere and security, user-access, multi-user conflicts in tables, etc., will need to be handled somehow. Sharepoint does it effortlessly to the developer and there are many reasonably-priced hosting services out there. You can find 30-day free trials to host and demo sites to customers if needed as well. I have used www.accesshosting.com for such a demo and been happy.