Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

New Database Problem

Status
Not open for further replies.

VeryNewbie2004

Programmer
Sep 9, 2004
16
US
I am having a problem creating a new Access Database from VB6.

I have tried just about everything I can think of, yet the simple task of creating a mdb file seems to be beyond me.

If anyone can help I would appreciate it loads.

Cheers

Mike
 
You know what I have just done this. For some reason the code I wrote in the first place seems to have just started working - I hate computers
 
Dimandja

I can't believe how simple this was - I havbe been tearing my hair out for the entire afternoon:

Dim app_Access As Access.Application
Set app_Access = New Access.Application

Str_OutputDB = "U:\PLEASEPLEASEPLEASE.mdb"
Str_OutputFile = "u:\TEST.csv"

With app_Access

'Make New Database

.NewCurrentDatabase (Str_OutputDB)

'Create Table (tbl_Digests)

.DoCmd.RunSQL "CREATE TABLE " & Str_OutputDB & ".tblDigests(FilePath VarChar(255), FileName VarChar(100), DigestNumber VarChar(100));"

Open Str_OutputFile For Input As #1

Do While Not EOF(1)

Line Input #1, Str_FileLine

.DoCmd.RunSQL "INSERT INTO " & Str_OutputDB & ".tblDigests(FilePath,FileName,DigestNumber) VALUES (" & Str_FileLine & ");"

Loop

Close #1

.Quit acQuitSaveNone

End With

Cheers

Mike

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top