How to Create a Relationship in Access

To create a relationship in Access 2013 or 2016:

  1. While viewing a table in Design view, and ensuring that the DESIGN tab is selected, click Relationships from the Ribbon
  2. A Show Table dialog will appear with a list of tables and queries. Select the tables (and/or queries) that you wish to create a relationship between, and close the dialog
  3. The Relationships tab will appear with the selected tables. Click and drag a field on top of a field in another table to initiate a relationship.
  4. The Edit Relationships dialog will pop up containing both fields. Make any adjustments and click OK

This will create the relationship. You will see the tables in the Relationship tab with lines depicting the relationship between the tables.

Continue reading

How to Create a Form in Access

To create a form in Access 2013 or 2016:

  1. On the left navigation pane, click the table or query that contains the data for your form
  2. From the Create tab on the Ribbon, click Form

This creates a form based on the table or query that you selected from the navigation pane. You can modify the form as required.

You can also create a blank form (using the Blank Form button) or you can use the Form Wizard to create a form.

Continue reading

How to Create a Query in Access

To create a query in Access 2013 or 2016:

  1. Click the CREATE > Query Design button on the Ribbon.
  2. Choose the tables to include in the query
  3. Choose the fields to include, and adjust the criteria
  4. Click the Run button (or just switch to Datasheet view)

The results of the query will be displayed.

You also have the option of saving your query. To save the query, right-click on the query tab. click Save, and name it at the prompt.

Continue reading

What is a Stored Procedure?

A stored procedure is a series of SQL statements compiled and saved to the database.

Stored procedures can be as simple or as complex as you like. However, one of the benefits of stored procedures is that they allow you to store complex scripts on the server.

Stored procedures often contain conditional programming such as IF... ELSE statements for example. Stored procedures can also accept parameters.

Continue reading

What is a View?

In the world of databases, a view is a query that’s stored on a database.

The term can also be used to refer to the result set of a stored query.

To create a view, you write a query, then save it as a view.

To run a view, you query it, just like you’d query a table. The difference is that, the view itself is a query. So when you query the view, you’re effectively querying a query.  This enables you to save complex queries as views, then run simple queries against those views.

Continue reading

What is a Foreign Key?

A foreign key is a field that is linked to another table‘s primary key field in a relationship between two tables.

In relational database management systems, a relationship defines a relationship between two or more tables. That is, the data in one table is related to the data in the other. One table contains the primary key and the other table contains the foreign key.

When we establish a relationship between the tables, we link the foreign key with the primary key. From that point on, any value in the foreign key field should match a value from the primary key field in the other table.

Continue reading

What is a Primary Key?

A primary key is one or more columns that have been configured as the unique identifier field for the table.

Most primary keys are comprised of a single column, but they can also be comprised of multiple columns.

Any value stored in a primary key field is unique to that record. No other record contains that value. The value is a unique identifier.

Continue reading

What is a Relationship?

In relational database design, a relationship is where two or more tables are linked together because they contain related data. This enables users to run queries for related data across multiple tables.

Relationships are a key element in relational database design.

Here’s an example:

Diagram of one-to-many relationship
Example of one-to-many relationship.

In the above example, the City table has a relationship with the Customer table. Each customer is assigned a city. This is done by using a CityId field in the Customer table that matches a CityId in the City table.

While it’s certainly possible to store the full city name in the Customer table, it’s better to have a separate table that stores the city details. You can easily use a query to look up the CityName by using the CityId that’s stored for that customer.

Continue reading