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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to implement DoCmd.TransferText

Status
Not open for further replies.

BradCustom

IS-IT--Management
Oct 5, 2007
296
US
I'd like to use the DoCmd.TransferText to export a table as a fixed width text file but I'm not sure how to implement the code.
Do I link it to a macro or to a button click?

Thanks for the help!
 
Use a SpecificationName you've created doing the job manually.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks for responding,

I've tried that but the part I'm not sure about is how to use the VBA code. Should I create a module or place the code in the switchboard linking it to one of the command buttons or somehow use the code in a macro.

Below is the code:
Code:
Private Sub Command0_Click()
    DoCmd.TransferText acExportFixed, "Export-Weekly Payroll Template", "Weekly Payroll Template", "M:\PTO\Weekly Payroll Hours\Weekly Payroll Template.txt", True

End Sub

Thanks for your help!
 
If you plan to add this code to switchboard:
- add module and paste the code,
- make the procedure public, i.e. remove 'Private' from the procedure declaration (first line: [tt]Sub Command0_Click()[/tt]). It does not matter, but the procedure name could be more descriptive,
- in the switchboard wizard, add item, with 'run code' action and procedure name from the code.

combo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top