|
-
Jul 4th, 2006, 02:07 AM
#1
Thread Starter
New Member
[RESOLVED] How do I export a to a text file not using TransferText
Hi Guys
I am using VBA.
I have created a form with a subform in it and they are both liked with a suplier number.
My problem is that I want to export to a text file using a botton. I want the information on the text file in this format.
The first line to be suplier number from the parent table. The second line to be the invoices from the child table which is my subform.
I have tried using the write and TransfareText method but have not succeded if you have any idea please assist.
Thanx a million.
-
Jul 4th, 2006, 02:16 AM
#2
Hyperactive Member
Re: How do I export a to a text file not using TransferText
Hi there
To write to a text file try something like this.
VB Code:
Private Sub Command1_Click()
Dim ff As Integer
ff = FreeFile()
Open ("C:\test.txt") For Append As ff
Print #ff, 'Your recordset'
Close
End Sub
Hope this sets you on the right path. If you need more help let me know as i have done this quite a bit lately.
-
Jul 4th, 2006, 02:35 AM
#3
Thread Starter
New Member
Re: How do I export a to a text file not using TransferText
 Originally Posted by alexanderjames
Hi there
To write to a text file try something like this.
VB Code:
Private Sub Command1_Click()
Dim ff As Integer
ff = FreeFile()
Open ("C:\test.txt") For Append As ff
Print #ff, 'Your recordset'
Close
End Sub
Hope this sets you on the right path. If you need more help let me know as i have done this quite a bit lately.
Thank you sir
I have tried that method and it worked fine with the parent form, but accessing the information on the subform is the problem now.
How can I seach the child table from the form and print the result on the to the same text file.
Regards
-
Jul 5th, 2006, 02:49 AM
#4
Hyperactive Member
Re: How do I export a to a text file not using TransferText
Hi there
If you could post your code, then i am sure i could help you out.
Regards
-
Jul 5th, 2006, 05:13 PM
#5
Re: How do I export a to a text file not using TransferText
The syntax for obtaining data on the child form when in the parent form is:
childformname.datathing
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.
Please Help Us To Save Ana
-
Jul 5th, 2006, 05:31 PM
#6
Re: How do I export a to a text file not using TransferText
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Apr 2nd, 2009, 05:39 AM
#7
New Member
Re: How do I export a to a text file not using TransferText
Hi
I've tried using the transfertext method, with no success. Keep getting error 424: object not defined.
You mention another way. This creates the text file, but doesnt put anything in it. What I'm looking for is a way to export all the records of an access table to a text file. I would have thought this would have been easier than it is!!
Can anyone help?
Thanks
-
Apr 2nd, 2009, 06:08 AM
#8
Re: How do I export a to a text file not using TransferText
you have to put what you want to print to the file in the line
print #ff, "test to print to file"
you can print any string or content of variable,or recordset, into the file
btw, better to start your own thread
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|