Automate and Visual Basic

O

oscarc

I m currently wanting to automate a procedure through Access, using
Visual Basic.

A report is ran with another program, which then converts it to .txt
file.

I want to create a module to grab this txt file, to delim report, and
put tables into it. Then wanting to e-mail it to the appropriate
person.

So far I have the following:

Public Function ImportMthExtFile()
DoCmd.SetWarnings False
'DoCmd.DeleteObject acTable, "MthExtract"
DoCmd.TransferText acImportDelim, "MthExtractImport",
"c:\MthExtract.txt", -1 (I get an error messages here, telling me, you
cannot import this file)

'Dim dbs As Database
'Dim tbl As TableDef

Set dbs = CurrentDb()
Set tbl = dbs.TableDefs("MthExtract")
tbl.Fields.Append tbl.CreateField("Month", dbText)
tbl.Fields.Append tbl.CreateField("Year", dbInteger)

DoCmd.OpenQuery "qupdMthExtractMonthYear", acNormal, acEdit
DoCmd.SetWarnings True
End Function

Anyones help will be much appreciated..Need help!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top