ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel VBA To Control Access (https://www.excelbanter.com/excel-programming/273764-excel-vba-control-access.html)

Jeff[_18_]

Excel VBA To Control Access
 
Hi,

I have an Excel VBA program written where in part of the
Excel program it Imports an ASCII comma-delimated file
into a New Access Database into a New Table, then returns
back to Excel & does other things. This is working fine.
I will put the Code I am using for this.

However now what I would like to do is in addtion to the
above, if possible, is after the Access File is created &
the Table is created & the ASCII data is imported to be
able to Programatically convert it to Acceess 97 format &
save it in Access 97 format rather than it saving the
default of what I have which is Access 2000 OR if
possible to initally create it in Access 97 format have it
create & save it that way.

In general I know there is a way to do this manually by
opeing up the Access Database & selectint TOOLS / DATABASE
UTILITIES / CONVERT DATABASE / TO PRIOR ACCESS DATABASE
VERSION. But again what I would like to achive is to do
this Programatically.

Here is the Code I am currently using to do the above.

' Create new instance of Microsoft Access.
Set appAccess = CreateObject("Access.Application")

' Open database in Microsoft Access window.
appAccess.NewCurrentDatabase AccessFileName

' Gets Database object variable.
Set dbs = appAccess.CurrentDb

' Creates new table
Set tdf = dbs.CreateTableDef(TableName)

' imports ASCII file
appAccess.DoCmd.Transfertext acImportDelim, , TableName,
NewFile, True

Set appAccess = Nothing



Any help would be greatly appreciated.

Thanks,
Jeff


All times are GMT +1. The time now is 08:56 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com