All programs seem to have some sort of time saving tips or special shortcuts and Microsoft Access is no exception. The casual user may not be aware of many of these tips, so at Arkware, we have shared a few query tips and tricks.
Top Values Setting
When in the design of any query, there is a setting to filter out the top records. The top values setting provides several different options. One option is to return a certain percentage of data. If you want to know the top 25% of your highest price orders, you just select the 25% option from the list. The important part of this feature is to always have the data in the proper sort order. The drop-down list has some pre-defined choices, but it allows any values entered.
It is often difficult to see everything in any part of a query when typing in the criteria or field name area. A keyboard shortcut of “Shift + F2” will bring up the zoom box. The zoom box allows you to see everything in one separate window.
Datasheet View button versus Run Button
When creating a standard query, there are two choices to see the query results. You can select either the datasheet button or the run button. However, when creating action queries (queries that perform action on records), using the run button will carry out the query. Before you run a delete or update query using the run button, you may want to see what or how many records are going to be updated or changed. Selecting the datasheet button will allow you to do this. Once you are confident of what records will be updated, then the run or action query button can be used.
ODBC Timeout Setting
Microsoft Access allows you to connect to other data sources such as a SQL Server database. Depending on the design of the SQL Server database and the number of records that are retrieved, it can take some time to retrieve those records.
The default ODBC (ODBC stands for “Object Database Connectivity) timeout setting is 60 seconds. This is the time it will take for the query to return data results. If it takes longer, the user will receive a time out error. A tip for this setting is to enter the value of zero in the setting. By entering a zero, the time out is set to unlimited. This means the user will not see a timeout error if it takes longer.
Parameter Query Setting
Microsoft Access offers many options for entering query criteria. One option is the parameter query option. This option prompts the user for specific data input. For example, you can have the option prompt for a specific data range by using the Between [Enter the start date] And [Enter the end date].
Sometimes you want to see all the records for a specific situation. For example, if you do not know the starting or ending dates for example, you may be excluding some records.
The tip for this feature is to add a statement at the end of the criteria. As noted below, the way to use this feature is once the query prompts the user to enter the date range, but not entering a date for the start and end date prompts, it will return all the records from the select query, and in this case all dates.
Hopefully, these tips will help you in your work with Microsoft Access. If you need help with your project or do not know where to begin in the design of any database, please reach out to Arkware for assistance.
Most users of Microsoft Access have, at some point, encountered the message that their database has been corrupted or placed in an “Inconsistent State”. You will see a dialog with the message: Microsoft Access has detected that this database is in an inconsistent state, and the software will attempt to recover the database.
Since my start with Microsoft Access 25 years ago, the frustrating aspect of this error is that there isn’t a definitive reason why the database became corrupted. Error messages in a variety of other software programs are much more descriptive on what to do to prevent violating the software rules. In Access, for example, there are characters that are not allowed when naming fields in a table. If you choose a character that is not aligned to the rules, the message that follows is clear. Select the Help button and then follow the rules displayed regarding table name rules.
So, what does one do regarding database corruption in Access?
First, it’s important to know that most Access databases become corrupt at some point in time. I’ve found the most proven methods to deal with corruption are not to waste time trying to determine why the database got corrupted, but rather focus on methods that prevent the database from getting corrupted in the first place.
Listed below are some things that Arkware consultants do that have helped reduce database corruption significantly:
- Split your database into a front-end and back-end (two separate files). All the database tables are in the back-end database and each user has their own copy of the front-end database on the desktop or local hard-drive. The front-end database contains all the database objects (queries, forms, reports, and macros/VBA). Each PC has the same folder structure such as (C:\WorkingDatabase\DatabaseName). Using the Linked Table Manager, link the tables from the back-end database to the front-end database. Access has a database splitting wizard that can assist with splitting the original database into the front-end and back-end databases. Look for a future Blog entry on using this wizard.
- Force the database to be shut down at close of business or other specific downtimes. This is done because users sometimes leave the system open and the unattended Access connection may get disconnected from the network, which can cause corruption. The code can be placed on the “OnTimer” event of any database form that remains open. The best database form to use is a main switchboard form. Simply add DoCmd.Quit to the VBA code to close the system down at a certain time of the day (ie 2:00 am).
- Make sure all users are using the same version of Access on all computers.
- Create a MS-DOS command batch file that copies a new front-end database to the local C:\ drive of the user’s computer. This is not mandatory, but it does ensure that everyone receives a clean copy of the local front-end database.
- Do not have tables from other Access databases linked to your main database that are using different versions of Access.
- Disable Access auto-correct feature. This can be done by selecting File > Options > Current Database. Under “Name Autocorrect Features”, deselect “Track Name Autocorrect”
These are some of the main preventive measures to guard against database corruption. If you are struggling with database corruption, reach out to Arkware and we can assist you in achieving a more stable environment for your Microsoft Access database.