James-
That's a query, not VBA code. You could do it like this:
CurrentDb.Execute "ALTER TABLE MyTable ALTER COLUMN ID Counter(1, 1);", dbFailOnError
Substitute your table name for "MyTable".
John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications
SQL Queries for Mere Mortals
(Paris, France)
On Dec 30, 2015, at 3:35 PM, James Asante asanteza@gmail.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:
Hi John,
Getting "Compile error: Expected: end of statement"
Regards,
James
On Wed, Dec 30, 2015 at 3:02 PM, John Viescas JohnV@msn.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:
James-
Run a query like this:ALTER TABLE MyTable ALTER COLUMN ID Counter(1, 1);John Viescas, AuthorMicrosoft Access 2010 Inside OutMicrosoft Access 2007 Inside OutMicrosoft Access 2003 Inside OutBuilding Microsoft Access ApplicationsSQL Queries for Mere Mortals(Paris, France)
On Dec 30, 2015, at 12:56 PM, James Asante asanteza@gmail.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:HiI have a table that is deleted and appended from time to time. The primary key has the following properties:Field Name = IDData Type = AutoNumberField Size = Long IntegerNew Values = IncrementIndexed = Yes (No Duplicates)Text Align = GeneralIs there a way to get the ID to start at 1 when the table is cleared (deleted) and appended every time?ThanksJames
__._,_.___
Posted by: John Viescas <johnv@msn.com>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (4) |
.
__,_._,___
Tidak ada komentar:
Posting Komentar