Export access table to notepad
Hi Richard,
Try the following:-
Sub access()
Dim ac As Object
Const acExportDelim = 2 'Required with late binding
On Error Resume Next
'Try GetObject first in case Access already open
Set ac = GetObject(, "Access.Application")
If Err.Number 0 Then
'Error is returned by GetObject if Access not
'already open so use CreateObject
On Error GoTo 0 'Reset error trapping ASAP
Set ac = CreateObject("Access.Application")
End If
ac.OpenCurrentDatabase "k:\warehouse\lm's\test.mdb"
'ac.Visible = True
'Can only use following line if Access is visible
'but there is no need to make it visible.
'AppActivate "Microsoft Access"
ac.DoCmd.TransferText acExportDelim, , "tbl_main", "E:\test.txt"
ac.Quit
Set ac = Nothing
End Sub
--
Regards,
OssieMac
|