473,503 Members | 1,638 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Creating an Index in a Table

8 New Member
Hi - I am trying to create a unique index in an existing table that I will be able to use later to update records. I have the code below. The index Ind field is being created in the table TempAPT but it is not populating with an index. A simple index starting at 1 and growing at an increment of 1 for each row will suffice. What am I doing wrong? This is in VBA Access 2003. Thanks

Expand|Select|Wrap|Line Numbers
  1. Public Sub addColAPT()
  2. DoCmd.SetWarnings False
  3.  
  4. strSql = "ALTER TABLE TempAPT ADD COLUMN Ind DOUBLE"
  5. CurrentProject.Connection.Execute strSql
  6.  
  7. strSql = "CREATE INDEX Ind ON TempAPT(Ind)"
  8. CurrentProject.Connection.Execute strSql
  9.  
  10. DoCmd.SetWarnings True
  11.  
  12. End Sub
  13.  
Jun 22 '10 #1
1 1365
acoppini
8 New Member
Figured it out - need to use autoincrement as field type:

Expand|Select|Wrap|Line Numbers
  1. strSql = "ALTER TABLE TempAPT ADD COLUMN Ind AUTOINCREMENT"
  2. CurrentProject.Connection.Execute strSql
  3.  
Jun 22 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
5639
by: Galina | last post by:
Hello I am trying to create a table, which includes a field type LONG. The wizard hasn't allowed me to enter storage settings for this table. It set the initial size is 64K and not available to...
1
1518
by: Doron | last post by:
is there a setting that will ebnable uniform extent allocation upon creation of index/table by default ? if there isn't any default setting can you code it in? thanks, Doron
1
1524
by: Daniele | last post by:
Hi, how is it possible to create a full-text index table? Thanks, Daniele
3
1881
by: Priya | last post by:
Hi, I need to create a temp table in my asp.net web services program. I have an xml file of the format <uom_masters> <uom_code>varchar</uom_code> <uom_description>varchar</uom_description>...
1
2386
by: Rako | last post by:
My problem is: I want to create an index to any of the available picture-groups. This index is a table of thumbs with a scrollbar. If you click on the thumb, you get the full picture displayed. ...
12
2658
by: smiler2505 | last post by:
I have a database, where I need to create a table if it doesn't exist. This is my code at the moment: Sub CreateCwS() Dim daotbl As DAO.TableDef If Not daotbl.Name =...
5
2504
by: KewlToyZ | last post by:
Good day, I am stuck in a strange situation. SQL 2000 Server, creating a stored procedure to use in Crystal Reports 11. I am trying to build a report without creating a table or temprorary table in...
1
1327
by: replica watch | last post by:
I am creating a table cell by cell (create the table, add columns, create row, add cells to the row) in which I want to add the capability for users to sort ASC and DESC by column header. Can...
3
3160
by: grumpygit | last post by:
Hi. I am trying to get the columns in the navigation/index table to all be the same width on the page in link below. Code in attached .zip file Any advice would be greatly appreciated as I am a...
4
1793
by: monion | last post by:
I am having a heck of a time creating a table with more than 140 or so columns when using php into mysql. Any known issues after a certain #? Thanks,
0
7202
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7086
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7280
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
5578
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5014
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3167
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3154
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1512
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
382
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.