|
-
Jun 22nd, 2006, 08:02 AM
#1
Thread Starter
Member
copy records from access db into notepad
Hi all,
I have a table in access with one column with data inside. I want to copy all of the data in this column into notepad. Can anybody tell me how to do this?
Many thanks
Carlos
-
Jun 22nd, 2006, 08:32 AM
#2
Re: copy records from access db into notepad
From an exe or with VBA within Acces?
Either Way it would be handy to know the name of the table an the name of the field in the table.
And in A VB exe the filename an path would help as well.
 why can't programmers keep and 31 Oct and 25 dec apart. Why Rating is Useful
for every question you ask provide an answer on another thread.
-
Jun 22nd, 2006, 08:44 AM
#3
Thread Starter
Member
Re: copy records from access db into notepad
-
Jun 22nd, 2006, 10:58 AM
#4
Re: copy records from access db into notepad
Comments in the code.....
Code:
Option Compare Database
Option Explicit
Sub OutPutToNotePad()
'Open a recordset to read the content of the table.
Dim Rc As DAO.Recordset
Dim FileNumber As Long
Set Rc = CurrentDb.OpenRecordset("SELECT Tabel1.* FROM Tabel1", dbReadOnly, dbForwardOnly)
'Open A textFile to store the content of your table (this file will be overwritten each time you run this
FileNumber = FreeFile()
Open "C:\Temp\AccessOutputFile.Txt" For Output As #FileNumber
'Write all records
Do While Not Rc.EOF
Write #FileNumber, Rc.Fields(0)
Rc.MoveNext
Loop
'close the file
Close #FileNumber
'open the file in Notepad
Shell "Notepad 'C:\Temp\AccessOutputFile.Txt'"
End Sub
You need to alter the file and table name.
 why can't programmers keep and 31 Oct and 25 dec apart. Why Rating is Useful
for every question you ask provide an answer on another thread.
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
|