Ask Experts Questions for FREE Help !
Ask
    cuuplate's Avatar
    cuuplate Posts: 4, Reputation: 1
    New Member
     
    #1

    Jun 21, 2009, 01:54 PM
    VBA Code for adding an autonumber primary key
    Can anyone provide code for adding an autonumber field to an existing database and then making that field the primary key?

    Thank you.
    ScottGem's Avatar
    ScottGem Posts: 64,966, Reputation: 6056
    Computer Expert and Renaissance Man
     
    #2

    Jun 21, 2009, 02:04 PM

    Can I ask Why you want to do this in VBA? Don't you have access to the tables? Since this is a one time deal, why bother?
    cuuplate's Avatar
    cuuplate Posts: 4, Reputation: 1
    New Member
     
    #3

    Jul 1, 2009, 09:06 PM
    Quote Originally Posted by ScottGem View Post
    Can I ask Why you want to do this in VBA? Don't you have access to the tables? Since this is a one time deal, why bother?
    This is not a one-time deal. I have code to automatically import data from an excel spreadsheet. I want to add code to add a primary key index to this import to speed up queries based on this data. The data is imported as 18 separate tables, and it is refreshed weekly. So, I don't want to have to manually add 18 indexes every single week.

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

Who is Primary [ 1 Answers ]

Is a group insurance policy primary over an individual insurance plan?

Autonumber fields in Access 2007 [ 1 Answers ]

In Access 2007, when I create a new table, it defaults to an ID field that is autonumber. That is great and works as expected. When I create another field within the same table and want it to also autonumber, that is not a presented option when I try to format that field. How do I set a second...

Primary residence [ 2 Answers ]

About a year ago, I purchased a home in Missouri after the bank foreclosed on my mother's home. She lives with me now at the new house. I have recently decided to move and possibly get married. I would like my mother to be able to continue living at the house if possible. I don't believe that...

Primary Education [ 1 Answers ]

Can u tell me the requirements for B. Ed Primary in your country! Thanks


View more questions Search