creating access db within vb 3.0 
Author Message
 creating access db within vb 3.0

If you did not include the contents of the DATACONS.TXT file in your
program, then that might be your problem.  I'd simply suggest you
leave it out.

Set DB = CreateDataBase("C:\MYDB.MDB")

  -- Robert


Quote:
>I am having a very basic problem trying to create a new database with VB
>3.0 Professional Edition. The code below results in a "invalid argument"
>error for the entire "set DB = ..." line.
>Dim DB as DataBase
>Set DB = CreateDataBase("C:\MYDB.MDB", DB_LANG_GENERAL)
>Also, if I try to declare a new field, and then assign it a type, I get an
>"invalid field type" error
>I am getting the feeling that I haven't properly setup VB for databases or
>something...
>Any help would be greatly appreciated.
>Thanks,
>Steve Bronstein



Fri, 06 Mar 1998 03:00:00 GMT  
 creating access db within vb 3.0
I am having a very basic problem trying to create a new database with VB
3.0 Professional Edition. The code below results in a "invalid argument"
error for the entire "set DB = ..." line.

Dim DB as DataBase
Set DB = CreateDataBase("C:\MYDB.MDB", DB_LANG_GENERAL)

Also, if I try to declare a new field, and then assign it a type, I get an
"invalid field type" error

I am getting the feeling that I haven't properly setup VB for databases or
something...

Any help would be greatly appreciated.

Thanks,

Steve Bronstein



Fri, 06 Mar 1998 03:00:00 GMT  
 creating access db within vb 3.0
The VB manual  called Professional Features Book2 has an example for
creating a database with related tables.  This assumes you are using the
Professional version.  Here is some code to get you going some of which
is not in the manual.

Set DB = CreateDatabase(DatabaseFileName, DB_LANG_GENERAL)

TB.Name = "NewTable"

FD.Name = "counter"
FD.Size = 4
FD.Type = 4
FD.Attributes = 17
TB.Fields.Append FD
Set FD = Nothing

FD.Name = "description"
FD.Size = 255
FD.Type = 10
FD.Attributes = 2
TB.Fields.Append FD
Set FD = Nothing

Ix.Name = "PrimaryKey"
Ix.Fields = "+counter"
Ix.Primary = -1
Ix.Unique = -1
TB.Indexes.Append Ix
Set Ix = Nothing
DB.TableDefs.Append TB
Set TB = Nothing

Hope this helps!

Alex.



Sun, 08 Mar 1998 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Need to Create Access DB within VB5Prof

2. Newbie question - creating DB from within VB

3. Using Access 2.0 VBA modules from within VB 3.0

4. Create SQL Server DB from within VB

5. How to create a form in VB (with access db) and create an ActiveX Object

6. VB 3.0 and Access 2.0 DB error message...

7. Problem when accessing a SQL Anywhere DB from within VB 5

8. Open Access DB within VB and pass to

9. Opening a db within Access VB code

10. Challenge to VB 3.0 / Access 2.0 guru: Creating new field of type Counter

11. How to create a MS-ACCESS 2.0 database from VB 3.0 Prof

12. Can't create an access 2.0 file using VB 3.0

 

 
Powered by phpBB® Forum Software