Thursday, January 31, 2019

EMailDatabaseObject Macro Action

EMailDatabaseObject Macro Action

You can use the EMailDatabaseObject macro action in Access desktop databases to include the specified Access datasheet, form, report, or module in an electronic mail message, where it can be viewed and forwarded.

Note: Beginning in Access 2010, the SendObject macro action was renamed to EMailDatabaseObject.

Note: This action will not be allowed if the database is not trusted.

Settings

The EMailDatabaseObject action has the following arguments.

Action argument

Description

Object Type

The type of object to include in the mail message. Click Table (for a table datasheet), Query (for a query datasheet), Form (for a form or form datasheet), Report, Module, or Data Access Page, Server View, Stored Procedures, or Function in the Object Type box in the Action Arguments section of the macro design window. You can't send a macro. If you want to include the active object, select its type with this argument, but leave the Object Name argument blank.

Object Name

The name of the object to include in the mail message. The Object Name box shows all objects in the database of the type selected by the Object Type argument. If you leave both the Object Type and Object Name arguments blank, Access sends a message to the mail application without any database object.

If you run a macro containing the EMailDatabaseObject action in a library database, Access looks for the object with this name first in the library database, then in the current database.

Output Format

The type of format you want used for the included object. The list of formats you can select from will change depending on what you select for the Object Type argument. Available formats may include Excel 97 - Excel 2003 Workbook (*.xls), Excel Binary Workbook (*.xlsb), Excel Workbook (*.xlsx), HTML (*.htm, *.html), Microsoft Excel 5.0/95 Workbook (*.xls), PDF Format (*.pdf), Rich Text Fomat (*.rtf), Text Files (*.txt), or XPS Format (*.xps). in the Output Format box. Modules can be sent only in text format. Data access pages can only be sent in HTML format. If you leave this argument blank, Access prompts you for the output format.

Note: If you're using Access 2007, you can export to a PDF or XPS format file from only after you install the add-in. For more information, see Save or convert to PDF or XPS.

To

The recipients of the message whose names you want to put on the To line in the mail message. If you leave this argument blank, Access prompts you for the recipients' names.

Separate the recipients' names you specify in this argument (and in the Cc and Bcc arguments) with a semicolon (;) or with the list separator set on the Number tab of the Regional Settings Properties dialog box in Microsoft Windows Control Panel. If the mail application can't identify the recipients' names, the message isn't sent and an error occurs.

Cc

The message recipients whose names you want to put on the Cc ("carbon copy") line in the mail message. If you leave this argument blank, the Cc line in the mail message is blank.

Bcc

The message recipients whose names you want to put on the Bcc ("blind carbon copy") line in the mail message. If you leave this argument blank, the Bcc line in the mail message is blank.

Subject

The subject of the message. This text appears on the Subject line in the mail message. If you leave this argument blank, the Subject line in the mail message is blank.

Message Text

Any text you want to include in the message in addition to the database object. This text appears in the main body of the mail message, after the object. If you leave this argument blank, no additional text is included in the mail message. If you leave the Object Type and Object Name arguments blank, you can use this argument to send a mail message without a database object.

Edit Message

Specifies whether the message can be edited before it's sent. If you select Yes, the electronic mail application starts automatically, and the message can be edited. If you select No, the message is sent without the user having a chance to edit the message. The default is Yes.

Template File

The path and file name of a file you want to use as a template for an HTML file. The template file is a file containing HTML tags.

Remarks

The object in the mail message is in the selected output format. When you double-click the object, the appropriate software starts with the object opened.

The following rules apply when you use the EMailDatabaseObject action to include a database object in a mail message:

  • You can send table, query, and form datasheets. In the included object, all fields in the datasheet look as they do in Access, except fields containing OLE objects. The columns for these fields are included in the object, but the fields are blank.

  • For a control bound to a Yes/No field (a toggle button, option button, or check box), the output file displays the value –1 (Yes) or 0 (No).

  • For a text box bound to a Hyperlink field, the output file displays the hyperlink for all output formats except MS-DOS text (in this case, the hyperlink is just displayed as normal text).

  • If you send a form in Form view, the included object always contains the form's Datasheet view.

  • If you send a report, the only controls that are included in the object are text boxes and (in some cases) labels. All other controls are ignored. Header and footer information is also not included. The only exception to this is that when you send a report in Excel format, a text box in a group footer containing an expression with the Sum function is included in the object. No other control in a header or footer (and no aggregate function other than Sum) is included in the object.

  • Subreports are included in the object.

  • When you send a datasheet, form, or data access page in HTML format, one .html file is created. When you send a report in HTML format, one .html file is created for each page in the report.

To run the EMailDatabaseObject action in a Visual Basic for Applications (VBA) module, use the SendObject method of the DoCmd object.

image

The following link was provided by Luke Chung. Luke is the founder and president of FMS, Inc., a leading provider of custom database solutions and developer tools.

Optimize the Outlook mobile app for your iOS or Android phone

Optimize the Outlook mobile app for your iOS or Android phone

Optimize the Outlook mobile app for your phone or tablet

After you set up email in Outlook for Android or Outlook for iOS, you can customize the mobile app to stay connected the way you want. Click on the handy tips below to learn how to optimize Outlook for your mobile device.

Customize swipe options to quickly take action on emails in your inbox.

  1. Tap Settings > Swipe Options.

  2. Tap Swipe Right or Swipe Left and select an action.

Focused Inbox separates your inbox into two tabs—Focused and Other. Your most important emails are on the Focused tab while the rest remain accessible on the Other tab. Focused Inbox is on by default.

  1. Tap Settings.

  2. Scroll down to Focused Inbox, then tap the button to toggle the setting.

Organize mail by thread arranges messages as conversational threads based on the message Subject. Organize mail by thread is on by default.

  1. Tap Settings.

  2. Scroll down to Organize mail by thread, then tap the button to toggle the setting.

  1. Switch to the Calendar view.

  2. Tap the View icon, then select AgendaDay, or 3-Day view.

On Android

  1. Tap and hold to select the message.

  2. Tap an action from the list.

       Android message actions

On iOS

  1. Tap the message to open it.

  2. Tap the ellipses … , then tap an action.

      iOS action list

Update notifications for specific email accounts

  1. Open the Outlook app.

  2. Go to Settings > Notifications under Mail OR Notifications under Calendar.

  3. Change which email accounts you wish to see notifications for.

Update device notifications for the Outlook app

  1. On your device, go to Settings > Notifications.

  2. Scroll down your list of apps to Outlook.

  3. Update how you wish to receive notifications.

On both Android and iOS you can easily add Outlook to the "dock" on your home screen. This means that no matter what page of your home screen you're on, the Outlook app will always be just 1-click away.

  1. Hold your finger on the Outlook app icon.

  2. Drag it to the dock/app bar at the bottom of your screen.

    Note: If you need to make room, hold your finger on an another app in the dock and drag it onto the home screen.

Adding the Outlook calendar widget makes it easy to get your agenda for the day. You'll always be able to see your upcoming events at a glance!

On Android

  1. Hold your finger on an empty space on your home screen.

  2. Tap Widgets at the bottom of your screen.

  3. Swipe until you find the Outlook group. Tap it.

  4. Touch and hold the Outlook Agenda widget and move it to where you want in your home screen.

  5. Choose your settings and tap Ok. Then drag the borders of the widget to the size you like.

On iOS

  1. Swipe down from the top of your screen to bring down the notification center.

  2. Swipe to the right to view your widgets and scroll to the bottom. Tap Edit.

  3. Scroll down the list of apps and tap the + next to Outlook. Tap Done.

You can access your widgets easily by swiping down or swiping to the left most screen on home.

Avoid clutter on your phone or tablet's screen by hiding the unused email and calendar apps that come with your phone.

On Android

  1. Hold your finger on the native email apps like Gmail or Calendar.

  2. Drag it to the trash can icon that says Remove at the top of your screen.

    Note: Don't worry! This does not delete the app, it simply removes it from your home screen. You can always re-add it again later.

On iOS

  1. Hold your finger on the native email apps like Mail or Calendar.

  2. When the apps are shaking, drag one on top of the other to make a new folder.

    Note: Doing this makes it easy to clear space on your home screen, as Apple doesn't allow you to hide or remove these apps.

Updating the Outlook app to the latest version means you get all the bug fixes, security updates, and new features you need to be productive. You can update the Outlook mobile app from your device's app store.

On Android

  1. Open the Play Store on your Android device.

  2. Search for Microsoft Outlook.

  3. Tap Update.

    Note: If it says Open instead of Update, then you're already on the latest version of Outlook for Android.

On iOS

  1. Open the App Store on your iPhone or iPad.

  2. Tap Updates on the bottom bar.

  3. Scroll to Microsoft Outlook and tap Update.

    Note: If it says Open instead of Update, then you're already on the latest version of Outlook for iOS.

Need help?

Name fields

Name fields

The Name field contains the name of a task or a resource.

There are several categories of Name fields.

Data Type    Text

Name (task field)

Entry Type    Entered

Best Uses    Make an entry in the Name field to represent, identify, and describe the name of a task.

Example    You are adding a new task that has to do with writing a proposal for a potential new customer. In the Name field on the Gantt Chart view, you type "Write Proposal" to identify and describe the task.

Name (resource field)

Entry Type    Entered

Best Uses    Make an entry in the Name field to represent and identify the name of a resource.

Example    To identify Sean as a resource in your project, you type "Sean M. Garcia" in the Name field in the Resource Sheet view.

Remarks    Always try to use different names for different resources in your project. If you have resource names that are identical, you can add a department name, a middle initial, or some other unique qualifier to the name to make it distinct. For example, if there are two resources in your project by the name of Jeff Smith, one can be "Jeff Smith (Accounting)" and the other can be "Jeff Smith (Customer Service)."

Create, edit or delete a relationship

Create, edit or delete a relationship

A relationship in Access helps you combine data from two different tables. Each relationship consists of fields in two tables with corresponding data. For example, you might have a ProductID field in a Products table and in an OrderDetails table. Each record in the OrderDetails table has a ProductID that corresponds to a record in the Products table with the same ProductID.

When you use related tables in a query, the relationship lets Access determine which records from each table to combine in the result set. A relationship can also help prevent missing data, by keeping deleted data from getting out of synch, and this is called referential integrity.

Before you work with relationships, make sure you understand the background concepts. For more information, see Guide to table relationships and Get started with table relationships.

In this article

Overview

Create a table relationship by using the Relationships window

Create a table relationship by using the Field List pane to add a field

Edit a relationship

Enforce referential integrity

Delete a table relationship

Create, edit, or delete a relationship in a Web App

Create or modify a relationship in an Access 2010 web database

Overview

In an Access database, you create a table relationship using one of the following methods:

  • In the Relationships window, add the tables that you want to relate, and then drag the field to relate them from one table to the other table.

  • Drag a field on to a table datasheet from the Field List pane.

When you create a relationship between tables, the common fields are not required to have the same names, although it is often the case that they do. The common fields must have the same data type. If the primary key field is an AutoNumber field, however, the foreign key field can also be a Number field if the FieldSize property of both fields is the same. For example, you can match an AutoNumber field and a Number field if the FieldSize property of both fields is Long Integer. When both common fields are Number fields, they must have the same FieldSize property setting.

Top of Page

Create a table relationship by using the Relationships window

  1. On the Database Tools tab, in the Relationships group, click Relationships.

  2. If you have not yet defined any relationships, the Show Table dialog box automatically appears. If it does not appear, on the Design tab, in the Relationships group, click Show Table.

    The Show Table dialog box displays all of the tables and queries in the database. To see only tables, click Tables. To see only queries, click Queries. To see both, click Both.

  3. Select one or more tables or queries and then click Add. After you have finished adding tables and queries to the Relationships document tab, click Close.

  4. Drag a field (typically the primary key) from one table to the common field (the foreign key) in the other table. To drag multiple fields, press the CTRL key, click each field, and then drag them.

    The Edit Relationships dialog box appears.
    Edit Relationships dialog box

  5. Verify that the field names shown are the common fields for the relationship. If a field name is incorrect, click on the field name and select the appropriate field from the list.

    To enforce referential integrity for this relationship, select the Enforce Referential Integrity check box. For more information about referential integrity, see the section Enforce Referential Integrity.

  6. Click Create.

    Access draws a relationship line between the two tables. If you selected the Enforce Referential Integrity check box, the line appears thicker at each end. In addition, again only if you selected the Enforce Referential Integrity check box, the number 1 appears over the thick portion on one side of the relationship line, and the infinity symbol () appears over the thick portion on the on the other side of the line, as shown in the following figure.

    Drag a field from one table to the matching field in the other table.

    Notes: 

    • To create a one-to-one relationship    Both of the common fields (typically the primary key and foreign key fields) must have a unique index. This means that the Indexed property for these fields should be set to Yes (No Duplicates). If both fields have a unique index, Access creates a one-to-one relationship.

    • To create a one-to-many relationship    The field on the one side (typically the primary key) of the relationship must have a unique index. This means that the Indexed property for this field should be set to Yes (No Duplicates). The field on the many side should not have a unique index. It can have an index, but it must allow duplicates. This means that the Indexed property for this field should be set to either No or Yes (Duplicates OK). When one field has a unique index, and the other does not, Access creates a one-to-many relationship.

Top of Page

Create a table relationship by using the Field List pane to add a field

You can add a field to an existing table that is open in Datasheet view by dragging it from the Field List pane. The Field List pane shows fields available in related tables and also fields available in other tables in the database.

When you drag a field from an "other" (unrelated) table and then complete the Lookup Wizard, a new one-to-many relationship is automatically created between the table in the Field List pane and the table to which you dragged the field. This relationship, created by Access, does not enforce referential integrity by default. To enforce referential integrity, you must edit the relationship. See the section Edit a relationship for more information.

Open a table in Datasheet view

  • In the Navigation Pane, double-click the table.

Open the Field List pane

  • Press ALT+F8. The Field List pane appears.

    Field List pane

The Field List pane shows all of the other tables in your database, grouped into categories. When you work with a table in Datasheet view, Access displays fields in either of two categories in the Field List pane: Fields available in related tables and Fields available in other tables. The first category lists all of the tables that have a relationship with the table with which you are currently working. The second category lists all of the tables with which your table does not have a relationship.

In the Field List pane, when you click the plus sign (+) next to a table name, you see a list of all the fields available in that table. To add a field to your table, drag the field that you want from the Field List pane to the table in Datasheet view.

Add a field and create a relationship from the Field List pane

  1. With the table open in Datasheet view, press ALT+F8. The Field List pane appears.

  2. Under Fields available in other tables, click the plus sign (+) next to a table name to display the list of fields in that table.

  3. Drag the field that you want from the Field List pane to the table that is open in Datasheet view.

  4. When the insertion line appears, drop the field into position.

    The Lookup Wizard starts.

  5. Follow the instructions to complete the Lookup Wizard.

    The field appears in the table in Datasheet view.

When you drag a field from an "other" (unrelated) table and then complete the Lookup Wizard, a new one-to-many relationship is automatically created between the table in the Field List and the table to which you dragged the field. This relationship, created by Access, does not enforce referential integrity by default. To enforce referential integrity, you must edit the relationship. See the section Edit a relationship for more information.

Top of Page

Edit a relationship

You change a relationship by selecting it in the Relationships window and then editing it.

  1. Carefully position the cursor so that it points to the relationship line, and then click the line to select it.

    The relationship line appears thicker when it is selected.

  2. With the relationship line selected, double-click it.

    –or–

    On the Design tab, in the Tools group, click Edit Relationships.

The Edit Relationships dialog box appears.

Open the Edit Relationships dialog box

  1. On the Database Tools tab, in the Relationships group, click Relationships.

    The Relationships window appears.

    If you have not yet defined any relationships and this is the first time you are opening the Relationships window, the Show Table dialog box appears. If the dialog box appears, click Close.

  2. On the Design tab, in the Relationships group, click All Relationships.

    All tables with relationships are displayed, showing relationship lines. Note that hidden tables (tables for which the Hidden check box in the table's Properties dialog box is selected) and their relationships will not be shown unless Show Hidden Objects is selected in the Navigation Options dialog box.

  3. Click the relationship line for the relationship that you want to change. The relationship line appears thicker when it is selected.

  4. Double-click the relationship line.

    -or-

    On the Design tab, in the Tools group, click Edit Relationships.

    The Edit Relationships dialog box appears.

    Edit Relationships dialog box

  5. Make your changes, and then click OK.

    The Edit Relationships dialog box allows you to change a table relationship. Specifically, you can change the tables or queries on either side of the relationship, or the fields on either side. You can also set the join type, or enforce referential integrity and choose a cascade option. For more information about the join type and how to set it, see the section Set the join type. For more information about how to enforce referential integrity and choose a cascade option, see the section Enforce referential integrity.

Set the join type

When you define a table relationship, the facts about the relationship inform your query designs. For example, if you define a relationship between two tables, and you then create a query that employs the two tables, Access automatically selects the default matching fields based upon the fields specified in the relationship. You can override these initial default values in your query, but the values supplied by the relationship will often prove to be the correct ones. Because matching and bringing together data from more than one table is something you will do frequently in all but the most simple databases, setting defaults by creating relationships can be time saving and beneficial.

A multiple table query combines information from more than one table by matching the values in common fields. The operation that does the matching and combining is called a join. For instance, suppose you want to display customer orders. You create a query that joins the Customers table and the Orders table on the Customer ID field. The query result contains customer information and order information for only those rows where a corresponding match was found.

One of the values you can specify for each relationship is the join type. The join type tells Access which records to include in a query result. For example, consider again a query that joins the Customers table and the Orders table on the common fields that represents the Customer ID. Using the default join type (called an inner join), the query returns only the Customer rows and the Order rows where the common fields (also called the joined fields) are equal.

However, suppose you want to include all Customers — even those who have not yet placed any orders. To accomplish this, you have to change the join type from an inner join to what is known as a left outer join. A left outer join returns all of the rows in the table on the left side of the relationship and only those that match in the table on the right. A right outer join returns all of the rows on the right and only those that match on the left.

Note: In this case, "left" and "right" refer to the position of the tables in the Edit Relationships dialog box, not the Relationships window.

You should think about the result you will most often want from a query that joins the tables in this relationship, and then set the join type accordingly.

Set the join type

  1. In the Edit Relationships dialog box, click Join Type.

    The Join Properties dialog box appears.

  2. Click your choice, and then click OK.

The following table (using the Customers and Orders tables) shows the three choices that are displayed in the Join Properties dialog box, the type of join they use, and whether all rows or matching rows are returned for each table.

Choice

Relational join

Left table

Right table

1. Only include rows where the joined fields from both tables are equal.

Inner join

Matching rows

Matching rows

2. Include ALL records from 'Customers' and only those records from 'Orders' where the joined fields are equal.

Left outer join

All rows

Matching rows

3. Include ALL records from 'Orders' and only those records from 'Customers' where the joined fields are equal.

Right outer join

Matching rows

All rows

When you choose option 2 or option 3, an arrow is shown on the relationship line. This arrow points to the side of the relationship that shows only matching rows.

Make changes in the Join Properties dialog box

  1. On the Database Tools tab, in the Relationships group, click Relationships.

    Note:  If you have not yet defined any relationships and this is the first time you are opening the Relationships window, the Show Table dialog box appears. If the dialog box appears, click Close.

  2. On the Design tab, in the Relationships group, click All Relationships.

    All tables that have relationships are displayed, showing relationship lines. Note that hidden tables (tables for which the Hidden check box in the table's Properties dialog box is selected) and their relationships will not be shown unless Show Hidden Objects is selected in the Navigation Options dialog box.

  3. Click the relationship line for the relationship that you want to change. The relationship line appears thicker when it is selected.

  4. Double-click the relationship line. The Edit Relationships dialog box appears.

  5. Click Join Type.

  6. In the Join Properties dialog box, click an option, and then click OK.
    Join Properties dialog box

  7. Make any additional changes to the relationship, and then click OK.

Top of Page

Enforce referential integrity

The purpose of referential integrity is to prevent orphan records – records that reference other records that no longer exist. You enforce referential integrity by enabling it for a table relationship. Once enforced, Access rejects any operation that would violate referential integrity for that table relationship. This means that Access will reject both updates that change the target of a reference and deletions that remove the target of a reference. To have Access propagate referential updates and deletions so that all related rows are changed accordingly, see the Set the cascade options section.

Turn referential integrity on or off

  1. On the Database Tools tab, in the Relationships group, click Relationships.

  2. On the Design tab, in the Relationships group, click All Relationships.

    All tables with relationships are displayed, showing relationship lines. Note that hidden tables (tables for which the Hidden check box in the table's Properties dialog box is selected) and their relationships will not be shown unless Show Hidden Objects is selected in the Navigation Options dialog box.

  3. Click the relationship line for the relationship that you want to change. The relationship line appears thicker when it is selected.

  4. Double-click the relationship line. The Edit Relationships dialog box appears.

  5. Select or clear Enforce Referential Integrity.

  6. Make any additional changes to the relationship, and then click OK.

If you enforce referential integrity, the following rules apply:

  • You cannot enter a value in the foreign key field of a related table if that value doesn't exist in the primary key field of the primary table — doing so creates orphan records.

  • You cannot delete a record from a primary table if matching records exist in a related table. For example, you cannot delete an employee record from the Employees table if there are orders assigned to that employee in the Orders table. You can, however, choose to delete a primary record and all related records in one operation by selecting the Cascade Delete Related Records check box.

  • You cannot change a primary key value in the primary table if doing so would create orphan records. For example, you cannot change an order number in the Orders table if there are line items assigned to that order in the Order Details table. You can, however, choose to update a primary record and all related records in one operation by selecting the Cascade Update Related Fields check box.

    Notes: If you have difficulty enabling referential integrity, note that the following conditions are required to enforce referential integrity:

    • The common field from the primary table must be a primary key or have a unique index.

    • The common fields must have the same data type. The one exception is that an AutoNumber field can be related to a Number field that has a FieldSize property setting of Long Integer.

    • Both tables exist in the same Access database. Referential integrity cannot be enforced on linked tables. However, if the source tables are in Access format, you can open the database in which they are stored and enable referential integrity in that database.

Set the cascade options

You might encounter a situation where you have a valid need to change the value on the "one" side of a relationship. In such a case, you need Access to automatically update all of the affected rows as part of a single operation. That way the update is completed in full so that your database is not left in an inconsistent state — with some rows updated and some not. Access helps you avoid this problem by supporting the Cascade Update Related Fields option. When you enforce referential integrity and choose the Cascade Update Related Fields option, and you then update a primary key, Access automatically updates all fields that reference the primary key.

You might also need to delete a row and all related records — for instance, a Shipper record and all related orders for that shipper. For this reason, Access supports the Cascade Delete Related Records option. When you enforce referential integrity and select the Cascade Delete Related Records check box, Access automatically deletes all records that reference the primary key when you delete the record that contains the primary key.

Turn cascade update and/or cascade delete on or off

  1. On the Database Tools tab, in the Relationships group, click Relationships.

  2. On the Design tab, in the Relationships group, click All Relationships.

    All tables with relationships are displayed, showing relationship lines. Note that hidden tables (tables for which the Hidden check box in the table's Properties dialog box is selected) and their relationships will not be shown unless Show Hidden Objects is selected in the Navigation Options dialog box.

  3. Click the relationship line for the relationship that you want to change. The relationship line appears thicker when it is selected.

  4. Double-click the relationship line.

    The Edit Relationships dialog box appears.

  5. Select the Enforce Referential Integrity check box.

  6. Select either the Cascade Update Related Fields or the Cascade Delete Related Records check box, or select both.

  7. Make any additional changes to the relationship, and then click OK.

Note: If the primary key is an AutoNumber field, selecting the Cascade Update Related Fields check box will have no effect, because you cannot change the value in an AutoNumber field.

Top of Page

Delete a table relationship

Important: When you remove a relationship, you also remove referential integrity support for that relationship, if it is enabled. As a result, Access will no longer automatically prevent the creation of orphan records on the "many" side of a relationship.

To remove a table relationship, you must delete the relationship line in the Relationships window. Position the cursor so that it points to the relationship line, and then click the line. The relationship line appears thicker when it is selected. With the relationship line selected, press DELETE.

  1. On the Database Tools tab, in the Relationships group, click Relationships.

  2. On the Design tab, in the Relationships group, click All Relationships.

    All tables with relationships are displayed, showing relationship lines. Note that hidden tables (tables for which the Hidden check box in the table's Properties dialog box is selected) and their relationships will not be shown unless Show Hidden Objects is selected in the Navigation Options dialog box.

  3. Click the relationship line for the relationship that you want to delete. The relationship line appears thicker when it is selected.

  4. Press the DELETE key.

  5. Access might display the message Are you sure you want to permanently delete the selected relationship from your database?. If this confirmation message appears, click Yes.

Note: If either of the tables employed in the table relationship are in use — perhaps by another person or process, or in an open database object, such as a form — you will not be able to delete the relationship. You must close any open objects that employ these tables before you try to remove the relationship.

Top of Page

Create, edit, or delete a relationship in an Access web app

There are important differences when working with relationships in an Access web app.

Create a relationship

The Relationships window isn't available in an Access web app. Instead of creating a relationship in an Access web app, you create a lookup field that gets values from a related field in another table. For example, let's say you have an Employees table and you want to add a lookup to a Regions table so you can show which region each employee works in.

Note:  The field that your lookup will use as the source for values must already exist before you create your lookup field.

Here's how you create a lookup field in an Access web app:

  1. Open the table where you want to create a new lookup field by double-clicking it in the navigation. (Hint: you may need to click Home > Navigation Pane to see the available tables.)

    In the above example, click the Employees table.

  2. Click in the Field Name column just below the last field in the table and type a name for your new lookup field.

    In the example, type Region as the field name.

  3. In the Data Type column, click the arrow and select Lookup.

    Setting the Lookup data type for a lookup field

    The Lookup Wizard starts.

  4. On the first page of the Lookup Wizard, select I want the lookup field to get values from another table or query. More options appear in the dialog box.

  5. Select the name of the table or query that should provide the values for your lookup.

    In the example, select Table: Regions.

    Options to choose in Lookup Wizard

    (Names of the tables in the image correspond to the example we're using.)

  6. After you select the table, use the Which value do you want to display in your lookup list to select the field that you want to use as a display value for your lookup field. By default, Access selects the first text field it can find in the selected table.

    In the example, you would leave the selected field, Title, as the display value.

  7. Use the Do you want to sort the items in your lookup list to set the sorting, if you want.

  8. Under What should happen when a record from the "Regions" table is deleted, set the type of relationship you want between the two tables and whether you want to enforce referential integrity. (The name of the table in this question varies depending on which table you selected in step 5.)

    The Lookup Wizard defaults to Prevent delete if there are corresponding records in the "Employees" table, because that's the safest option in most cases. In the example, this option means you can't delete a value from the Regions table if that region is being used in records in the Employees table. So, if employee records are using a region, such as "West" and you try to delete "West" from the Regions table, Access will prevent you from deleting it. In this case, you need to reset all employee records using that value to something else, before you can delete "West" from the Regions table. The last option could work in this example, because that would allow you to delete "West" from the Regions table. The region value would be automatically removed from Employee records that were set to "West," leaving the value blank. Choosing the second option would delete all employee records from the Employees table that have the region set to "West." That's called a cascading delete and would delete much more data than you want in the example. Be careful when choosing that option.

Edit a relationship

The Relationships window isn't available in an Access web app. You use a field in one table as the source (lookup field) for values in the related field in another table.

  1. Open the table that contains the lookup you want to change by clicking Edit Table.

    Edit Table

  2. Select the field that gets its values from another table.

  3. On the Design tab, under Table Tools, click Modify Lookups.

  4. Follow the steps in the wizard to make the changes that you want. You can change the following:

    • The field that is the source of values

    • The sort order of the values

    • The width of the field, and whether to hide the key column

    • The label for the lookup field

    • Whether data integrity is enabled

    • If data integrity is enabled, whether deletes are cascaded or restricted

Delete a relationship

The Relationships window isn't available in an Access web app. You use a field in one table as the source (lookup field) for values in the related field in another table. In order to delete a relationship between two tables in an Access web app, you need to delete the lookup field and its associated data.

  1. Open the table that contains the lookup field you want to delete by clicking Edit Table.

    Edit Table

  2. Select the lookup field that gets its values from another table in the web app.

  3. On the Design tab, under Table Tools, click Delete Fields.

  4. Access displays the message Do you want to permanently delete the selected fields(s) and all the data in the field(s)? Click Yes to confirm deleting the lookup field and its data.

    Note: You might also be prompted by Access to delete one or more indexes when deleting the lookup field. If this confirmation message appears, click Yes.

  5. Click Save to save your table design changes.

Top of Page

Create or modify a relationship in an Access 2010 web database

To create a relationship in an Access 2010 web database, you use the Lookup Wizard. The Relationships window is not available in a web database. You use a field in one table as the source for values in the related field in another table.

Note:  The field that you use as the source for values must already exist before you can use the Lookup Wizard.

Create a relationship in an Access 2010 web database by using the Lookup Wizard

  1. Open the table that should get its values from the other table.

  2. To the right of the last field, click Click to Add, and then click Lookup & Relationship.

    Note:  You might need to scroll horizontally to see Click to Add.

  3. On the first screen of the Lookup Wizard, select I want the lookup field to get the values from another table, and then click Next.

  4. Select the table that has the source values, and then click Next.

  5. In the Available Fields box, double-click the field that has the source values, and then click Next.

  6. Optionally, specify a sort order for the lookup field. Click Next.

  7. Optionally, adjust the width of the lookup field – a good idea if the values are long. Click Next.

  8. Enter a name for the new field. If you want to make sure that the values in the two tables always match, select the Enable Data Integrity check box, and then click one of the following:

    • Cascade Delete – this option means that if you delete a record from one table, corresponding records in the other table are also deleted.

    • Restrict Delete – this option means that if you attempt to delete a record from one table but there is a corresponding record in the other table, the delete operation is not allowed.

      Note:  Do not select Allow Multiple Values in the Lookup Wizard when you are using the wizard to create a relationship.

Modify a relationship in an Access 2010 web database

  1. Open the table that gets its values from another table.

  2. Select the field that gets its values from another table.

  3. On the Fields tab, in the Properties group, click Modify Lookups.

  4. Follow the steps in the wizard to make the changes that you want. You can change the following:

    • The field that is the source of values

    • The sort order of the values

    • The width of the field, and whether to hide the key column

    • The label for the lookup field

    • Whether data integrity is enabled

    • If data integrity is enabled, whether deletes are cascaded or restricted

Top of Page

See Also

Add a lookup field to a table

What is the Relationships window?

Compare two tables in Access and find only matching data