2 Replies - 3865 Views - Last Post: 16 December 2015 - 03:08 PM

#1 Coding in the name of  Icon User is offline

  • D.I.C Regular

Reputation: 67
  • View blog
  • Posts: 291
  • Joined: 07-July 10

Table relationship, lookup wizard

Posted 16 December 2015 - 02:26 PM

Hello. I have a table 'Sites' which just has two fields, an auto number as a primary key and a name string. In another table 'Shift patterns' I would like to have a lookup field which chooses the site to which the shift pattern is associated. When I make it so that the name string of the site shows up in the field once a value has been chosen I get an error in the relationship 'No unique index found for the referenced field of the primary table'. If I make it so that the site ID shows up in the field things seem to work, but I would prefer to have the name string of the site show up in the field so it's easier to browse. How can I solve this? Thanks.

Is This A Good Question/Topic? 0
  • +

Replies To: Table relationship, lookup wizard

#2 andrewsw  Icon User is offline

  • lashings of ginger beer
  • member icon

Reputation: 6340
  • View blog
  • Posts: 25,569
  • Joined: 12-December 12

Re: Table relationship, lookup wizard

Posted 16 December 2015 - 02:37 PM

Are you sure the Sites id alone is set as the primary key? And check that the related table doesn't already have any ids that don't match.

I wouldn't touch the Lookup Wizard. Add a ComboBox in the Design View of a form and configure its ControlSource, RowSource, Bound Column, Column Count and Column Widths properties.
Was This Post Helpful? 0
  • +
  • -

#3 Coding in the name of  Icon User is offline

  • D.I.C Regular

Reputation: 67
  • View blog
  • Posts: 291
  • Joined: 07-July 10

Re: Table relationship, lookup wizard

Posted 16 December 2015 - 03:08 PM

Thanks for your reply. The site ID is the only primary key for that table and the related table doesn't have any invalid IDs. Doing it with the form just seems to move the problem. Perhaps I'm barking up the wrong tree trying to get a non-unique field to show up where a unique ID should be stored. Maybe the relationship itself will make the DB easy enough to browse. I've uploaded my DB here if it helps: https://www.dropbox....ase3.accdb?dl=0
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1