Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2003

    Unanswered: add "unique record identifier" in code?

    OK, I have an access mdb project that uses linked SQL Server tables. When the user needs to relink the tables I use something similar to this:

    tmptable.Connect = "DSN=Myodbcdsn;Description=Myodbcdsn;UID=Name;PWD= Pass;APP=MyApp;WSID=MyComp;DATABASE=MyDB;"

    This works fine for all of my tables but I also have a view to link. Now the link works, but you can't update the data b/c it doesn't know what the key is...So my question is, is there a way to set the unique identifier in code (either from VB or in access VBA)?

    something like:
    if tablename = "vw_user" then
    table.identifier = "Name"
    table.identifier = "Email"
    end if


  2. #2
    Join Date
    Jul 2003
    Ok guys I figured it out. If anyone wants to know you just add an index on the linked table:

    Call CurrentDb.Execute("CREATE UNIQUE INDEX NameIDX ON myTable (field1, field2);")

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts