taking over an existing microsoft access application

50
Copyright © 2012 FMS, Inc., www.fmsinc.com Taking over an Existing Microsoft Access Application By Luke Chung President FMS, Inc. www.fmsinc.com

Upload: ferris-ross

Post on 31-Dec-2015

26 views

Category:

Documents


1 download

DESCRIPTION

Taking over an Existing Microsoft Access Application. By Luke Chung President FMS, Inc. www.fmsinc.com. FMS Background. Founded in 1986 We’re experienced commercial software developers: first product in 1987 In 1993, we introduced one of the first Microsoft Access products for Access 1.1 - PowerPoint PPT Presentation

TRANSCRIPT

Access Product Demos from FMS, Inc.

Taking over an Existing Microsoft Access ApplicationBy Luke ChungPresidentFMS, Inc.

www.fmsinc.comCopyright 2012 FMS, Inc., www.fmsinc.com 1FMS BackgroundFounded in 1986Were experienced commercial software developers: first product in 1987In 1993, we introduced one of the first Microsoft Access products for Access 1.1Were the worlds leading developer of 3rd party products for Microsoft AccessWe currently offer 13 products for Microsoft Access users and developersCopyright 2012 FMS, Inc., www.fmsinc.com FMS Professional ServicesOffering custom consulting services since 1987Services include design, development, testing, deployment; system review and optimizationWide range of solutions for commercial and government agenciesCustomize Microsoft technology such as Access, SQL Server, VB6, Visual Studio .NET, LightSwitch, Exchange/Outlook, ASP, IIS, Mobility, Azure, etc.Copyright 2012 FMS, Inc., www.fmsinc.com OverviewIntroductionTaking ControlQuick WinsMultiple Databases and Multiuser IssuesUpsizing to SQL Server?Copyright 2012 FMS, Inc., www.fmsinc.com 4Why There Are So Many Access Databases?Access debuted in 1992Access is the most popular desktop database in the worldLots of people have created Access applications over the yearsAs part of Office, people created lots of Access databases with various levels of successDatabases have longer life spans than Word or Excel documentsMost of these need to be maintained and enhancedMost do not need or cannot justify the cost of a complete rewrite on a new platformCopyright 2012 FMS, Inc., www.fmsinc.com 5Most Organizations Dont Know How to Deal with AccessToo many databases to manageDont know what they doWerent professionally developed originallyPeople who created them are goneDont have Access expertise on staffDont know or not convinced that Access can really create professional applicationsNot part of the .NET, Java or SQL Server goals of the IT departmentLots of business pressure to enhance existing applicationsCopyright 2012 FMS, Inc., www.fmsinc.com 6Understanding Objectives and TradeoffsProfessional Access applications exist and can be created by people who know how to do soMake sure objectives are within the capabilities of AccessDatabase sizeNumber of simultaneous usersNot a web applicationMake sure everyone understands the tradeoffs and advantages of AccessSaving time: most of the application is doneSaving money: some features are easier to implementEnd user flexibility: queries, reports, exportsNot going to be perfectRapid application development solutionCopyright 2012 FMS, Inc., www.fmsinc.com 7Working with Decision MakersDefine what it means to be successfulTechnology is a tool, not the objectiveEstablish trustFirst Win: Triage and address most pressing needsWhat are the critical pain points?Stability, specific features, response to requests, accuracy, performance, etc.?Prioritize objectives/goalsAgree it will never be perfect or doneRecognize and celebrate milestonesMake sure its collaborative You cant read minds You cant know their work as well as they doEstablish rapid design, build, and deployment cyclesCopyright 2012 FMS, Inc., www.fmsinc.com 8Are You Personally Responsible?Do you think you are?Does your boss/client think you are?If you created the database or took it over from someone else, youre responsible and liableRecommend a good disaster recovery plan (DRP)Create a good DRPIf theres no budget or time, get written verification that someone else is responsible for the DRPCopyright 2012 FMS, Inc., www.fmsinc.com 9Create a Disaster Recovery PlanCritical to backup the back-end database containing the latest dataDetermine how often to make backupsDepends how often the data changesDepends on the cost of losing dataIf its on the network, there may already be network backup routines runningRolling backups are importantKnow how many versions of the database are keptDetermine if thats adequateTest and make sure backups workCopyright 2012 FMS, Inc., www.fmsinc.com 10Create a Database Compact PlanAccess/Jet databases need to be periodically compacted for optimal performanceCompact at least once a dayRequires exclusive lock to the databaseAutoCompact when the database closes does not work on back end databasesBackup as often as youre willing to lose workData extracts may help if exclusive lock is not possibleWatch out for table relationships (referential integrity)Consider from FMS:Total Access Admin: Real-time monitoringhttp://www.fmsinc.com/MicrosoftAccess/monitor.asp Total Visual Agent: Scheduled maintenancehttp://www.fmsinc.com/MicrosoftAccess/Scheduler.html Copyright 2012 FMS, Inc., www.fmsinc.com 11OverviewIntroductionTaking ControlQuick WinsMultiple Databases and Multiuser IssuesUpsizing to SQL Server?Copyright 2012 FMS, Inc., www.fmsinc.com 12Taking Control: OverviewUnderstanding the ArchitectureRegular MaintenanceVisual Source SafeApplication Deployment Startup SettingsRobust Error HandlingQuality Assurance and Deployment PlanCopyright 2012 FMS, Inc., www.fmsinc.com 13Understanding the Database ArchitectureIs the application single user or multi-user?How the data goes in and out of the application?Is it all from data entry?Is data shared by other applications?If so, what do those applications do to the data?Is it all in Access (Jet)?If so, is it broken up into a front-end and backend database?Does it use data from other sources?Linked tables (Jet, SQL Server, etc.)Imports from download files, Excel, etc.Does it export data to other sources?Exports to Excel or WordExports for other applicationsIs there workgroup or password security?Do files violate Windows security (User Access Control)?Access files which require editing, cannot be installed in C:\Program FilesUse the Users Application Data folder for temporary filesCopyright 2012 FMS, Inc., www.fmsinc.com 14Front-End vs. Back-End DatabaseFundamental to supporting multiple users and application enhancementsBack-End database resides on the network and has all the data thats shared among usersFront-End database includes:Links to the back-end database tablesApplication objects (queries, forms, reports, code)Temporary/intermediate tables that are part of processing output to avoid multi-user collisionsFront-End database can be easily replaced without impacting the dataAvoids getting the users latest dataIs local to each user (performance gain)Copyright 2012 FMS, Inc., www.fmsinc.com 15Splitting a DatabaseAutomatedUse the Access Database Splitter featureManuallyCreate the back-end databaseCopy the existing database Delete all the queries, forms, reports, DAPs, macros, and modulesPut the database on a shared network driveCreate the front-end databaseCopy the existing databaseDelete all the tablesLink to the tables in the back-end databaseCopyright 2012 FMS, Inc., www.fmsinc.com 16Code Changes to a Split DatabaseMost code works identicallyMay need to add code to relink tables to support deployments to different drivesSeek commands need to be adjusted to point to the back-end database explicitlySeek commands are used to search tables on primary or secondary indexes which is much faster than Find.Code: SeekLinkedExample with DAOFor SQL Server and ADO, use query to retrieve the record rather than the seek commandCopyright 2012 FMS, Inc., www.fmsinc.com 17Working with What Youve GotAssumes the database is splitAvoid DisasterEstablish a backup and recovery planTest itCompact the back-end database regularlyUse Microsoft Visual Source SafeSimplify deployments of new front end databases make it easier to:Make updates without interrupting end usersDeploy fixes to minimize upset end-usersCopyright 2012 FMS, Inc., www.fmsinc.com 18Microsoft Visual Source Safe (VSS)Included in MSDN Provides source code control for Access development (and other platforms)Manages individual queries, forms, reports, macros, and modulesBad: All tables are managed as one objectCritical for multi-developer environmentsCheck-in and check-out objects to avoid writing over other peoples workValuable for individual developers tooCopyright 2012 FMS, Inc., www.fmsinc.com 19Using Visual Source SafeAvoids problems when using multiple machinesSee historic versions of each objectEasily shows differences between object versionsEasy to review and rollback mistakesShare the same object across Access databasesConsolidate utility modules in one placeMakes it easy to create latest versionTipsMake sure compiled state is always checked inTurn off automatic add for new objectsCRITICAL: Make sure the VSS repository is backed upCopyright 2012 FMS, Inc., www.fmsinc.com 20Simplifying Application DeploymentUsers should click on a shortcut and start the applicationAvoid having them know your database nameAvoid users loading Access, then opening your databaseMake sure the right version of Access is launched with the database do not trust Windows to just launch an MDB fileRecognize that what you build will have bugs and updates will be necessarySimplifying the deployment process reduces the pain of each update and makes you look betterMake it transparent to usersCopyright 2012 FMS, Inc., www.fmsinc.com 21Startup and Deployment PlanNeed to install front-end database and any dependencies on each desktopNeed to be able to deploy application updates efficientlyWhen updates are ready, each desktop needs a new copyNeed to make sure people launch your Access application with the right version of AccessUse a table in the front-end and back-end databases with the version number and code to know when they are out of syncWe use our Total Access Startup program to manage this across the network (zero deployment)Application distribution via shortcuts to everyoneAutomatically checked each time its started and front-end updated if its newhttp://www.fmsinc.com/MicrosoftAccess/VersionLauncher.aspCopyright 2012 FMS, Inc., www.fmsinc.com Database Startup SettingsLock down the applicationKeep users out of your databaseDont let them bypass your startup routinesDatabase AllowBypassKey propertyDisable the Access window close buttonHide Everything!Hide the database window/navigation paneHide all the objects in case they unhide the databaseHide the Access menus and ribbonsSuppress special keysMake sure Error Handler is set properlyApplication.SetOption Error Trapping, 1Copyright 2012 FMS, Inc., www.fmsinc.com 23Applying Robust Error HandlingWhen a crash occurs, users feel the whole application is brokenNo difference between minor vs. major problemsRobust error handling lets you know everything thats failing and howEliminates blaming end users for their mistakesForces developers to take responsibilitySimplifies analysis and reproduction of crashesLets you fix problems not explicitly reportedAutomatically disappears in next buildCritical to improving the stability and reliability of the application over timeLets you deploy ACCDE/ADE/MDEsCopyright 2012 FMS, Inc., www.fmsinc.com 24Understanding Existing Error HandlingReview the code to see how On Error is handledCascading error handlingErrors should be handled in each procedureSometimes people handle errors from parentNeed to understand this before applying global error handlingIs there an existing global error handler?How are errors presented to the user?Is there documentation of errors in text files or a table?Determine if error handling needs to be established in procedures that lack itCopyright 2012 FMS, Inc., www.fmsinc.com 25Robust Error HandlingGlobal error handler that:Prompts the user with a friendly form rather than the default Cancel/Debug dialogTells the end user what to do nextDocuments info to a text file or error table withError number, description, and lineProcedure call stackOther Access or Windows informationVersion of the application and WindowsLocation of database, user name, etc.Procedure call stack is not automatically available and requires documenting the procedure names as they are calledNeed to make sure all procedures exit at endCopyright 2012 FMS, Inc., www.fmsinc.com 26Total Visual CodeTools from FMSCode Cleanup Adds your custom error handling to all procedures that lack error handlingIndents code for programming logic and loopsBefore deployment, Code Delivery can add line numbers to all lines to pinpoint exactly where a crash occursNew Procedure Builder to create new code with your error handling and comment structures in placeLots of other code builders to simplify writing codeSupports VBA and VB6http://www.fmsinc.com/MicrosoftAccess/VBACodingTools.htmlCopyright 2012 FMS, Inc., www.fmsinc.com 27Establishing Quality Assurance ProcessCreate a way to test your application before deploymentSomeone other than the developer needs to testProduction vs. development environmentsCreate checklists of what it means to finishHold developers responsible for finishingNever bypass the QA proceduresAutomate process to deliver a new versionReset/empty temporary tables and settingsMake sure error handling is active Turn off debugging codeAdd line numbers to codeCreate the ACCDE, ADE, or MDECopyright 2012 FMS, Inc., www.fmsinc.com 28OverviewIntroductionTaking ControlQuick WinsMultiple Databases and Multiuser IssuesUpsizing to SQL Server?Copyright 2012 FMS, Inc., www.fmsinc.com 29Quick Wins: OverviewDocumenting and Analyzing the DatabaseFixing ErrorsMigrating Access 2003 or Earlier DatabasesUser InterfaceFormsReportsPerformance Enhancements

Copyright 2012 FMS, Inc., www.fmsinc.com 30Documenting and Analyzing the DatabaseBasic object documentation available in AccessTo understand relationships across all objects and code analysis, we use our Total Access AnalyzerPerforms documentation and analysis of your databasesGenerates cross-references for tables, queries, forms, reports, macros, and VBA codeDetects over 300 types of errors, design suggestions, and performance enhancementsIf there are errors, youre not ready to deployLots of other features to learn and apply best practiceshttp://www.fmsinc.com/MicrosoftAccess/BestPractices.html Copyright 2012 FMS, Inc., www.fmsinc.com 31Quick Wins: Fixing ErrorsDecompile the database to make sure theres no VBA junkRun MSACCESS.EXE with the /decompile option on the command lineVerify library referencesAdd Option Explicit to all modules and code behind forms and reportsGet compile errors rather than runtime errorsFix compile problems that ariseCopyright 2012 FMS, Inc., www.fmsinc.com 32Quick Wins: Fixing ErrorsMake sure there are no broken dependencies across queries, forms, and reportsTrap for Null problemsUse NullToZero Function: NZMake sure all tables have primary keysAdd Autonumber field for primary key where necessaryCopyright 2012 FMS, Inc., www.fmsinc.com 33Quick Wins: Migrating Access 2003 or Earlier DatabasesNew Options for the User InterfaceCurrent DatabaseDocument Window Options for Tabbed viewDisable design changes for tables in datasheet viewPicture Property StorageOption for smaller file format if youre not going back to older versionsDatasheetSet Alternate Background ColorRecommend: Light Background ColorDefault font: CalibriTotals RowCopyright 2012 FMS, Inc., www.fmsinc.com 34Quick Wins: Access 2007/2010 Form EnhancementsSupport form resizingAnchor objects, or use PopUp to avoid tab viewSplit FormsAdd Navigation Caption to DatasheetsEditable ComboBox lookup listAccess Options, Popular category: Color scheme Support Color Schemes on FormsMain Form: Background FormHeader and footers: Background Light HeaderLabels: Text Dark (dark blue)Buttons: System Button TextSupport New Buttons Graphics and text togetherCursor on hover set to Hyperlink HandBack Style set to TransparentCopyright 2012 FMS, Inc., www.fmsinc.com 35Quick Wins: Access 2007/2010 Report EnhancementsLearn about Report ViewAllows ad hoc filters of your reportsTotals are automatically recalculatedUse acViewReport option with DoCmd.OpenReportSend reports to PDFImproved layout designerCopyright 2012 FMS, Inc., www.fmsinc.com 36Quick Wins with the User InterfaceConsistency in look and feel across all the objects the user experiencesForms and ReportsExplicit Caption so object name doesnt appear in titleSame font and colors across objectsCan be different fonts based on type (e.g. buttons vs. labels), but be consistentSame info in same place, for example:Buttons always at the top or bottomReport footers with page number, etc.Spell check labels, captions, validation text, status bar text, message boxes, etc.Copyright 2012 FMS, Inc., www.fmsinc.com 37Quick Wins with FormsTurn XP Themed Form Control onSame form size (height/width) for similar formsSmooth navigation between formsDo not allow users to switch between views (form, datasheet, and pivot views)Improve ComboBoxesMake Limit to List is YesIncrease List Rows is greater than 8 (use 25+)AutoCenter = YesAutoResize = YesAdd BeforeUpdate event for record validationHelps with data entryAvoids problems with bad data laterCopyright 2012 FMS, Inc., www.fmsinc.com 38Quick Wins with ReportsMake sure all reports have Default Printer setGrouping KeepTogetherProperty should not be NoUse First Detail or Entire GroupAdd NoData event to handle empty reportsOne procedure to preview and/or print reportsReports should be previewed in maximized modeHandles NoData event closing the reportCopyright 2012 FMS, Inc., www.fmsinc.com 39Quick Wins Improving PerformanceKeep database handles open to all linked databasesIf not used, switch the SubdatasheetName of tables from [Auto] to [None]Replace multi-field keys with AutoNumberSignificantly improves secondary indexesTest adding indexes to fields in tables that are filteredFor slow forms and reports, change RecordSource from SQL to a saved queryMake sure Queries with Group By are not using Queries with Group ByReplace infinite DoEvents loops with SleepWatch for code to wait for form to close that could be replace by opening in Dialog mode

Copyright 2012 FMS, Inc., www.fmsinc.com 40Other EnhancementsGet rid of unused objectsJunk/old tables and queries often litter applicationsEliminate unused codeUnused proceduresUnused constants, variables, and parametersReview unreferenced variablesScope code narrowlyMake procedures, variables, and constants private if they dont need to be public/globalCopyright 2012 FMS, Inc., www.fmsinc.com 41OverviewIntroductionTaking ControlQuick WinsMultiple Databases and Multiuser IssuesUpsizing to SQL Server?Copyright 2012 FMS, Inc., www.fmsinc.com 42Managing Multiple DatabasesThere may be multiple copies of the same or similar databasesNeed to determine which copy is the masterConsolidate objects and codeConsider Total Access Detective from FMS to compare databases or objects for differences in object design, code, and datahttp://www.fmsinc.com/MicrosoftAccess/DatabaseCompare.html Copyright 2012 FMS, Inc., www.fmsinc.com 43Review Table StructuresExisting databases often have non-optimal database structuresDetermine if data is properly normalizedStructures should not change over timeDo not blame original developer because objectives change over timeChanging table structures is painful and potentially destabilizingNeed to balance working with a bad structure to the gain for fixing itMake sure all tables have primary keysMake sure referential integrity is set where necessary and defined properlyCopyright 2012 FMS, Inc., www.fmsinc.com 44Review Multiuser IssuesMultiuser issues can arise on one machineOptimistic vs. pessimistic lockingMake sure forms opening one after the other dont lock the same recordMake sure temporary tables are in the front end database so two users running the same thing at the same time dont collide or create wrong resultsIf data changes continuously, decide if consistent reports are requiredData snapshot for end of day (yesterday) reportsCopyright 2012 FMS, Inc., www.fmsinc.com 45OverviewIntroductionTaking ControlQuick WinsMultiple Databases and Multiuser IssuesUpsizing to SQL Server?Copyright 2012 FMS, Inc., www.fmsinc.com 46Deciding to Upsize to SQL ServerWhat is the expected size of the database?< 2 GB, Access may be acceptableHow many simultaneous users are expected?Access can handle 255 but 20-50 is more realisticDepends on what they are doing; more for read-only (e.g. reporting)How important is data integrity?SQL Server offers a complete audit log, automatic recovery and system maintenanceFile server databases require backup & compactHow important is performance?SQL Server applications do more, but tend to be slower than file server applicationsAre there interfaces to other applications such as the web?Copyright 2012 FMS, Inc., www.fmsinc.com 47Upsizing Access/Jet to SQL ServerMay be a considerable investment of time and effort depending on the complexity of the applicationPut back-end tables on SQL ServerConsider SQL Azure for $10/monthChoose MDB/ACCDB vs. ADP approachMDB/ACCDBs offer more front-end flexibility with the use of local tablesADPs are more friendly for supporting design changes on SQL ServerAccess enhancements focused on MDB/ACCDBsComplex topic, visit our web site for more informationhttp://www.fmsinc.com/MicrosoftAccess/SQLServerUpsizing/Copyright 2012 FMS, Inc., www.fmsinc.com 48ConclusionTaking over an existing application is challenging in any environment and not unique to AccessThe number of issues to address with an existing database application are numerousBuilding new features are only part of the solutionMake sure system administrative requirements are met because users will not want them until a disaster occursEstablish what it means to be successfulWork with end users and decision makers to show your commitment to their needsCopyright 2012 FMS, Inc., www.fmsinc.com 49FMS Web Site: fmsinc.comFREE Technical PapersSign-up for FREE newsletter for news and beta invitationsProduct Information and DemosEmail: [email protected] Facebook: http://www.facebook.com/fms.solutions Twitter: http://www.twitter.com/fmsinc

Copyright 2012 FMS, Inc., www.fmsinc.com 50