473,385 Members | 1,384 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Query and AutoNumber

Hi all,

I need a query, on a VB6 application, to create a new table with an
''AutoNumber" Field but I cannot find the correct syntax.
This one doesn't work:

sQuery = "CREATE TABLE sTableName "
sQuery = sQuery & "("
sQuery = sQuery & "IDRecord AutoNumber NOT NULL "
sQuery = sQuery & ");"

Using 'LONG' instead of 'AutoNumber' works, but it's not what I mean
it to be.
Can someone help me?

Thanks in advance.
Marco
May 8 '07 #1
4 4533
Hello Marco

The following sql works as a ddl query in Access 2003:

create table my_table (my_column counter not null)

Don't have VB6 so haven't tried it there.
Regards
Breadon

May 8 '07 #2
On Tue, 08 May 2007 13:17:16 +0200, MarcoEffe <ch******@tin.itwrote:

How about using DAO instead. This article describes it:
http://www.mvps.org/access/tables/tbl0016.htm
And bookmark that site!

-Tom.

>Hi all,

I need a query, on a VB6 application, to create a new table with an
''AutoNumber" Field but I cannot find the correct syntax.
This one doesn't work:

sQuery = "CREATE TABLE sTableName "
sQuery = sQuery & "("
sQuery = sQuery & "IDRecord AutoNumber NOT NULL "
sQuery = sQuery & ");"

Using 'LONG' instead of 'AutoNumber' works, but it's not what I mean
it to be.
Can someone help me?

Thanks in advance.
Marco
May 8 '07 #3
On 8 May 2007 06:58:13 -0700, breadon <br********@yahoo.co.ukwrote:
>Hello Marco

The following sql works as a ddl query in Access 2003:

create table my_table (my_column counter not null)

Don't have VB6 so haven't tried it there.
Regards
Breadon
Thanks a lot, now it works fine.

Regards
Marco
May 8 '07 #4
On Tue, 08 May 2007 07:20:10 -0700, Tom van Stiphout
<no*************@cox.netwrote:
>On Tue, 08 May 2007 13:17:16 +0200, MarcoEffe <ch******@tin.itwrote:

How about using DAO instead. This article describes it:
http://www.mvps.org/access/tables/tbl0016.htm
And bookmark that site!

-Tom.

Sorry but I have to stick to sql for this application.
And yet I should try and learn DAO, while I'm still in deep troble
with Acess SQL.

Regards
Marco
May 8 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Georges Heinesch | last post by:
I discovered a weird behaviour regarding a query and a combobox based on that query. 3 tables: Food: Food_ID number (autonumber - primary key) Number number Fruit_ID combobox
2
by: Dragon | last post by:
When I run a make-table query, the results take over 1 minute to return. The query is making a table that has 12,000 records in it. If I run the make-table query ONLY to see the records that will...
3
by: Gekko . via AccessMonster.com | last post by:
I want to create a query that the first field should be an autonumber. For example I want the name and last name from the Emp table, but I want that the first field is an autonumber that identifies...
4
by: Apple | last post by:
1. I want to create an autonumber, my requirement is : 2005/0001 (Year/autonumber), which year & autonumber no. both can auto run. 2. I had create a query by making relation to a table & query,...
1
by: Robert | last post by:
I am trying to create a db for service providers by county. I'm relatively new to db programming, but I have done quite a bit of programming ranging from the old basic days up to doing some...
2
by: manmit.walia | last post by:
Hello Fellow Developers, I am very new to SQL and ASP.net and in the learning process. I have to do a small web application that handles documents stored on a sql database. The requirements of the...
3
by: a_masselink | last post by:
It doesn't append anything to the primary key (autonumber, long integer), only to all the other fields. Even if I set all the fields to allow zero length: yes, indexed: no and required no. All the...
11
by: fyshfysh | last post by:
Hi all, A quick question about a function which surely should be possible in a Make-Table Query in Access. I wonder if it's possible to very simply have a field that numbers the rows in the...
10
hyperpau
by: hyperpau | last post by:
I've been going nuts about it and I've been searching all over the forums to find answers. Can somebody please help me? I am a somehow advanced Access user with basic VBA knowledge. (No ADO or...
1
by: plaforest | last post by:
Hello All, Thank you for your thoughtful consideration. I am running Access 2000 (9.0.3821 SR-1) This query works: SELECT , FROM table1
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.