Re: Create an MS Access Table in VB6
- From: "Ron Weiner" <rweineratworksritedotcom>
- Date: Fri, 12 Sep 2008 06:37:04 -0400
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
.
- Follow-Ups:
- Re: Create an MS Access Table in VB6
- From: MP
- Re: Create an MS Access Table in VB6
- From: Brian
- Re: Create an MS Access Table in VB6
- References:
- Create an MS Access Table in VB6
- From: Brian
- Create an MS Access Table in VB6
- Prev by Date: Re: Create an MS Access Table in VB6
- Next by Date: Re: AutoUpdate worst case scenarios, please
- Previous by thread: Re: Create an MS Access Table in VB6
- Next by thread: Re: Create an MS Access Table in VB6
- Index(es):
Relevant Pages
|