ms-access

Topics related to ms-access:

Getting started with ms-access

Apologies for the wall of text. Future edits will likely add screenshots and other visual elements.

Queries in Microsoft Access can be created by any one of four methods

  1. Using a step-by-step Query Wizard builder through the GUI which will ask you a series of questions about what data you wish to display and how various bits of data are related to each other.
  2. By using the GUI in Design View, in which you select tables and specific fields with your mouse. The visual ordering of the various fields can be specified by dragging the relevant columns in the bottom panel and additional properties for each field can be specified in the Properties panel (right).
  3. By switching from Design View to SQL View and specifying the raw SQL query code. Under most circumstances you can freely toggle between Design View and SQL View - Access will incorporate changes that you made in one view to the other. The syntax of Access SQL is similar to, but not identical to, that used in MySQL, PostgreSQL, Oracle, or MS SQL Server (tSQL).
  4. Using Visual Basic for Applications programming which can be accessed via the Macro group of the Database Tools ribbon (Access 2007+). Database manipulation occurs via the ADO or DAO libraries and uses the same syntax as SQL View in the main application, with the exception that various special characters have to be "escaped." Queries created via this method are not accessible directly from the Navigation Pane but must be placed in a function or subprocedure and either triggered by other elements (e.g. by a button in a Form) via Macros or directly executed in the VBA GUI interface.

Editing a record value from a query in datasheet view will result in a change in the underlying record value, assuming the query field is not an aggregation or concatenation of multiple sources of information.

Forms and Reports can be used to display information from queries in a form alternative to a simple "Datasheet" view which appears similar to an Excel-style spreadsheet. Forms are targeted to on-screen display, whereas Reports are targeted to those printed on paper.

Access SQL

Self-Referencing tables

In the example above, a reference field (SupID) can be used to indicate the ID of that employee's supervisor.

Using something as simple as a DLOOKUP can return the name of that supervisor.
eg. DLOOKUP("Name","EmployeeTable", "ID = " & SupID)


Another good example of this is to look at how automated Access switchboards are created, and more specifically the construct of the Switchboard table. Each switchboard option refers to another option within the same table - similar to how this example self references.

How to troubleshoot Access crashes

Be sure to remove other variables from the equation while testing

Network Corruption

Do not load the client off of a network. Put it on the local drive and run it from there.

Corporate Builds

If you are in a corporate environment that is using "computer builds" and have had no success with Decompiling, Testing Memory, nor stripping Binary data - then refuse to do further testing until the IT team can provide the user with a test machine that has only Windows, Office, and Service Packs installed.

All software and updates should be installed by hand without using unattended installs. Do not install antivirus on this machine for testing.

Understand that many IT departments simply try to do a One-Size-Fits-All approach with the builds, and their builds are all based on one another. Over time, software conflicts can directly cause Access to crash or act strange.

Bad Power

As mentioned in the memory example - power fluctuations can cause computer errors. If the database is in an industrial building, then try to get your hands on a power conditioner or a UPS that provides clean power (off the battery, not off the main passing through a Metal-oxide Varistor)

Also, check the power supply cable that is plugging into the power bar or outlet. Make sure that the gauge and voltage specs are sufficient. IT departments often leave power cables plugged in at the station and just remove the machine. After many years, they are using beefier power supplies, but haven't switched out the cable. It makes a difference. When in doubt, bring a new, thicker cable.

Parameterized Queries