ACC97: Ambiguous Error When Running a Make-Table Query
ID: Q187337
|
The information in this article applies to:
SYMPTOMS
Novice: Requires knowledge of the user interface on single-user computers.
When you run a make-table query that has an outer join between two tables,
you may receive the following error message:
You tried to assign the Null value to a variable that isn't
a Variant data type.
The error message does not clearly state the exact problem with the query
design.
CAUSE
The query is trying to populate a table where a field contains a Null
value and the data type is AutoNumber.
RESOLUTION
Use either of the following methods to work around this behavior.
Method 1
If you do not need the data returned by the AutoNumber field, omit that
field from the query.
Method 2
By modifying your existing query, you can create a new table and use an
append query to populate the table. To do so, follow these steps.
Creating a Table with the Same Structure
- After clicking OK on the error message described in the "Symptoms"
section, the query will be in Design view. Double-click the join line
and select the following property for the join:
Only include rows where the joined fields from both tables are
equal.
- On the Query menu, click Run.
- A dialog box will advise you that you are about to paste a number of
records into the new table; click Yes.
- Save the query as "qryTest."
- In the Database window, select the newly created table.
- On the Edit menu, click Copy.
- On the Edit menu click Paste.
- In the Paste Table As dialog box, type tblTest in the Table Name text box.
- Click the Structure Only option and click OK.
- Open the tblTest table in Design view.
- Change any fields whose data type is AutoNumber to Number.
- Close the tblTest table and click Yes in the Save Changes dialog box.
Appending the Records
- Open the qryTest query in Design view.
- Double-click the join line and select the following property for the
join:
Include ALL records from 'Customers' and only those records from
'Orders' where the join fields are equal.
- On the Query menu, click Append Query.
- On the Query menu, click Run.
- A dialog box will advise you that you are about to paste a number of
records into the new table. Click Yes.
Note that tblTest table now contains the desired records.
MORE INFORMATION
Steps to Reproduce Problem
- Open the sample database Northwind.mdb.
- Create the following query:
Query: MakeOrders
---------------------------------------------------------
Type: Make Table Query
Join: [Customers].[CustomerID] ---> [Orders].[CustomerID]
Field: Orders.*
Tables: Customers and Orders
NOTE: Make sure that the following property is selected for the join
(double-click the join line to check the join property):
Include ALL records from 'Customers' and only those records from
'Orders' where the join fields are equal.
- On the Query menu, click Make-Table Query.
- In the Make-Table dialog box, type TestJoin
in the Table Name box, and then click OK.
- On the Query menu, click Run.
Note that you receive the error message described in the "Symptoms"
section.
REFERENCES
For more information about query joins, search the Help Index for "joins,
overview," click "Join types and how they affect query results" from the
Topics Found dialog box, or ask the Office Assistant.
Additional query words:
error 3162
Keywords : QryMktbl
Version : WINDOWS:97
Platform : WINDOWS
Issue type : kbprb