No unique index found in the reference field of the primary table

G

Guest

I have imported 2 data tables from excel spreadsheets. The spreadsheet has
unique id numbers assosiated although when i try to assign them as the
primary key whe using the data import wizard it says they are not unique. I
have then added "autonumber" key to both tables once imported in the hope
that this would solve my problem. This key is set as the primary key in both
tables. When I try to link the 2 tables by the id i set in excel or any other
column and try to enforce referential integrity I get the error message "No
unique index found in the reference field of the primary table".

Can someone please help me with this as i do not understand how there is no
unique index when I have 2 unique id's?

Cheers.
 
D

Douglas J. Steele

Try running a query against the data to determine whether there are, in
fact, duplicates.

The SQL for the query to determine which values of Field1 in MyTable are
duplicated would be something like:

SELECT Field1
FROM MyTable
GROUPING BY Field1
HAVING Count(*) > 1
 
G

Guest

Thanks for the response Douglas,

Unfortunately it hasn't quite solved my problem. I am unable to run the
query you suggested. I am only a begginner at the program so please bare with
me if its just a simple error. My query below keeps giving me an error
message saying there is charecters found at end of SQL statement.

SELECT [Centre Information].Key
FROM [Centre Information];
GROUPING BY [Centre Information].Key
HAVING Count(*) >1

When i remove the ";" at the end of from as Help suggests I get a syntax
error in the FROM clause. Can you please help.

Thanks,

Matt
 
D

Dirk Goldgar

fordrules01 said:
Thanks for the response Douglas,

Unfortunately it hasn't quite solved my problem. I am unable to run
the query you suggested. I am only a begginner at the program so
please bare with me if its just a simple error. My query below keeps
giving me an error message saying there is charecters found at end of
SQL statement.

SELECT [Centre Information].Key
FROM [Centre Information];
GROUPING BY [Centre Information].Key
HAVING Count(*) >1

Should be:

SELECT [Centre Information].Key
FROM [Centre Information]
GROUP BY [Centre Information].Key
HAVING Count(*) >1
 
G

Guest

Thanks mate. Solved the problem.


Dirk Goldgar said:
fordrules01 said:
Thanks for the response Douglas,

Unfortunately it hasn't quite solved my problem. I am unable to run
the query you suggested. I am only a begginner at the program so
please bare with me if its just a simple error. My query below keeps
giving me an error message saying there is charecters found at end of
SQL statement.

SELECT [Centre Information].Key
FROM [Centre Information];
GROUPING BY [Centre Information].Key
HAVING Count(*) >1

Should be:

SELECT [Centre Information].Key
FROM [Centre Information]
GROUP BY [Centre Information].Key
HAVING Count(*) >1


--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
D

Douglas J. Steele

Oops. Thanks, Dirk.

I must remember to proof-read!

Sorry about that!

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Dirk Goldgar said:
fordrules01 said:
Thanks for the response Douglas,

Unfortunately it hasn't quite solved my problem. I am unable to run
the query you suggested. I am only a begginner at the program so
please bare with me if its just a simple error. My query below keeps
giving me an error message saying there is charecters found at end of
SQL statement.

SELECT [Centre Information].Key
FROM [Centre Information];
GROUPING BY [Centre Information].Key
HAVING Count(*) >1

Should be:

SELECT [Centre Information].Key
FROM [Centre Information]
GROUP BY [Centre Information].Key
HAVING Count(*) >1


--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

No unique index found 3
No Unique Index... 2
Table relationships 1
No Unique Index Found 3
Question about table relationships 1
No Unique index 15
Unique Index 1
Update primary Key. 1

Top