Re: Create an MS Access Table in VB6

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Sorry for the empty message above. My fingers got way ahead of my brain.
:-(

You do not necessarally have to use ADOX. You can run a simple DDL query to
make an Access table. Here is an example of a query that makes a table with
all of the allowed Access data types including an AutoNumber column that is
the Primary Key.

CREATE Table MyTable
(
MyID AutoIncrement CONSTRAINT MyIdConstraint PRIMARY KEY,
MyText CHAR(50),
MyByte BYTE,
MyInteger SMALLINT,
MyLong LONG,
MySingle SINGLE,
MyDouble DOUBLE,
MyDate DATETIME,
MyCurrency CURRENCY,
MyYesNo YESNO,
MyMemo MEMO,
MyOle OLEOBJECT,
MyBinary BINARY(100))

All you need do is create a connection to the database and execute the above
query. Code might look similar to:

Dim cn As ADODB.Connection

Set cn = New ADODB.Connection
cn.Open strConn ' your connection string
cn.Execute strsql ' the above sql statement
cn.Close
Set cn = Nothing

Access does not have extensive DDL support, certaintly nothing like Sql
Server, but you may find what it does have covers your needs.

Rdub


"Brian" <Brian@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:F649FE05-0A99-4246-A92F-8A3AB5783C5E@xxxxxxxxxxxxxxxx
Using VB6 and MS Access 2003. I would like to create a simple table in
the
database. I'm able to do this fine... but here's the catch. I want to
create an AutoNumbering Index in my table as a Primary Key. How do I do
that? I can make it a Primary Key, but can't seem to set the datatype as
autonumbering.

Second. How do I create a field that is a Lookup table query? Can this
be
accomplished via VB6?

My current DB interactions are ADO... but could use DAO if that is
better...

I have had little to no luck in my searches on the Internet.

Thanks


.



Relevant Pages

  • Re: DISTINCTROW
    ... the sql statement is querying 2 tables and 1 stored query. ... but these are not unique indexes. ... tblB does not have primary key and does not have index. ...
    (microsoft.public.access.queries)
  • referencing the outermost table from an inner view which is inside a subselect
    ... create table alm ( ... all_cod varchar2primary key, ... This mean that I have to write a SQL statement that cycles through all ... first query passing to it the values retrieved from all_cod_list instead ...
    (comp.databases.oracle.server)
  • Re: how to find out if there is any primary key in each table
    ... This query will return only those tables that do not have a primary key. ... > What is the command / stored procedure that will tell such information in ... > sql statement. ...
    (microsoft.public.sqlserver.programming)
  • Re: SET ENGINEBEHAVIOR 70?????
    ... One query is quicker to write than two queries, ... this because the id field is the primary key of the parent table. ... sumas Total from Parent join Child on ... > or use two SQL statement ...
    (microsoft.public.fox.vfp.queries-sql)
  • Re: Problem with Access concatenate query
    ... records in the final query. ... You probably need to INNER JOIN the tables, although on what column, I am not sure. ... PriceID -- Primary Key ... ItemID --- Foreign Key ...
    (microsoft.public.access.queries)