Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Access (https://www.askmehelpdesk.com/forumdisplay.php?f=441)
-   -   VBA Code for adding an autonumber primary key (https://www.askmehelpdesk.com/showthread.php?t=367496)

  • Jun 21, 2009, 01:54 PM
    cuuplate
    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.
  • Jun 21, 2009, 02:04 PM
    ScottGem

    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?
  • Jul 1, 2009, 09:06 PM
    cuuplate
    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.

  • All times are GMT -7. The time now is 11:40 AM.