Results 1 to 9 of 9
  1. #1
    Helystra is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Sep 2013
    Posts
    35

    Indexing question

    When using indexes is it ok to index a field by itself (and allow duplicates) and then use it as part of a multi field index which doesn't allow duplicates.



    For example. I have Employee Number, First Name and Last name fields in a table. If I index them separately allowing duplicates in the name fields but then index all three fields together so that I don't end up with more than one entry for the same employee is that OK or do I even need to index the fields individually at that point?

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    This is for your Employees table? Actually sounds like good idea.

    I have never even looked at setting up multi-field index. Interesting. I have one table where this could be useful.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Helystra is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Sep 2013
    Posts
    35
    I found it in Roger's Access blog. Seemed like it would be useful for keeping away duplicate entries. I just wasn't sure if doing a single field and then using that same field in a multi field index was a good idea or a no no.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    I don't think it will hurt. Although there is such a thing as overdoing indexing. Indexing on text fields is supposed to be slower than number fields.

    http://office.microsoft.com/en-us/ac...010210347.aspx
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Helystra is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Sep 2013
    Posts
    35
    I will give it a go and see. If it's too slow then I'll switch it up.

  6. #6
    Dal Jeanis is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742
    It's legal, but I'm not sure why you want a multifield index for that application. You shouldn't prevent the database from having two Jose Martinezes or two Jane Greens or two Tran Nguyens, so you need the Employee ID to make it unique, and if you already know the Employee ID number, then the name is redundant as far as lookup keys are concerned. So, what are you trying to achieve by the multifield key?

  7. #7
    Helystra is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Sep 2013
    Posts
    35
    I'm actually going to use it on the assignment table. I used employees as the example because it was easier. But if I apply the multi field index to the school job and the employee, I won't end up with duplicate entries assigning the same employee to the same job twice.

  8. #8
    Dal Jeanis is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742
    Ah, now THAT is a good usage. Very appropriate.

  9. #9
    Helystra is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Sep 2013
    Posts
    35
    Thanks. Remember, I was concerned about that problem and I think this will fix it.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 08-25-2012, 07:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums