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

Load data from Access table into Notepad 1

Status
Not open for further replies.

barnard90

IS-IT--Management
Mar 6, 2005
73
US
Hi

I have an Employee table in Access database.
It has fields
Empno, EmpId, DeptNo, Loc, Salary , Manager_id
It has close to 88,000 records in it

I would like to query the data with a recordset and later
I would like to dump all the data into a Note pad
Each field needs to be separated by ";" symbol

How could I do it
Could some one please suggest a VBA code for that

thanks
 



How about export the data to a comma separated values (csv) text file. Notepad is just an application for editing a text file.

Skip,
[sub]
[glasses]I'll be dressed to the nines this week, as I go to have my prostatectomy...
Because, if I'm gonna BE impotent, I want to LOOK impotent![tongue][/sub]
 
SkipVought

Thanks for the response
Actually each value has to be separated by a ";" and not a comma , because some of the data has commas in it

So I have to load into Note pad with ";" separator

Thanks
 
You can't choose the field delimiter when exporting to a text file ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 




"So I have to load into Note pad with ";" separator"

You have not loaded ANYTHING into Notepad.

You have to EXPORT it to a text file with a ; separator.

You CHOOSE to OPEN the text file with Notepad.

Sorry I missed the delimiter but, as you discovered, it is your choice.

Skip,
[sub]
[glasses]I'll be dressed to the nines this week, as I go to have my prostatectomy...
Because, if I'm gonna BE impotent, I want to LOOK impotent![tongue][/sub]
 
If you insist on using the ; and want a vba code you can look at

Code:
Sub testing()

    Dim dbs As Database
    Dim strsql
    Dim alpa
    Dim rst As Recordset
    Set dbs = currentdb
    strsql = "SELECT * FROM tblneedtoorder"
    Set rst = dbs.OpenRecordset(strsql)
    Dim fname
  
    fname = "c:\stuff.txt"
    Open fname For Output As #1
    Write #1, rst("Empno");rst("EmpId");rst("DeptNo") ;rst("Loc");rst("Salary");rst("Manager_id")

Close #1
Set rst = Nothing
Set dbs = Nothing

End Sub

ck1999
 
ck1999

Thanks a lot for your valuable post
That was useful
 
ck1999, why not simply use the DoCmd TransferText method with the appropriate SpecificationName ?
 
How does that use the ; ?
Specify the delimiter in the specifications.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top