Is there a way with VBA that I can simply open an access database?
Is there a way with VBA that I can simply open an access database?
yes, various different ways. I doubt you actually want to open the database though, just pull / push data to it?
I'm a big fan of using SQL to access an Access Db, if you'll pardon the pun.
Yes I use SQL to query also. But all I want is to open an access database. Within the access database I have a AutoExc macro that will run as soon as the file is open and i want that to run after I have exported some file using excel , so I need a piece of code to open access at the bottom of my code.
ExampleSub Auto_Dump() ' ' Auto_Dump Macro ' ' 'ActiveWorkbook.RefreshAll Sheets("Inbound").Select Range("Z1:BC2").Select Range(Selection, Selection.End(xlDown)).Select Selection.Copy Workbooks.Add Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _ xlNone, SkipBlanks:=False, Transpose:=False Application.CutCopyMode = False ChDir _ "S:\ISONAV BLAH BLAH\(S) Storage\Coll-GF\2-Rest\Dialler Live\Auto Dump Files" Application.DisplayAlerts = False ActiveWorkbook.SaveAs Filename:= _ "S:\ISONAV BLAH BLAH\(S) Storage\Coll-GF\2-Rest\Dialler Live\Auto Dump Files\Import Files\InboundImport.xlsx" _ , FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False ActiveWindow.Close Sheets("Outbound").Select Range("Table_Query_from_firstcl[[#Headers],[CallTypeCode]]").Select Range(Selection, Selection.End(xlToRight)).Select Range(Selection, Selection.End(xlDown)).Select Selection.Copy Workbooks.Add Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _ xlNone, SkipBlanks:=False, Transpose:=False Application.CutCopyMode = False Application.DisplayAlerts = False ActiveWorkbook.SaveAs Filename:= _ "S:\ISONAV BLAH BLAH\(S) Storage\Coll-GF\2-Rest\Dialler Live\Auto Dump Files\Import Files\OutboundImport.xlsx" _ , FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False OPEN ACCESS DATABASE HERE "S:\ISONAV BLAH BLAH\(S) Storage\Coll-GF\2-Rest\Dialler Live\Database_2015.accdb" ActiveWindow.Close End Sub
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks