[RESOLVED] export data from msaccess to txt file....
hello,
I hope thet someone can help me
I have databese in access 2000 named db2.mdb and a table withe the name Nomi
Nomi in italian it's Names
I whant to export records "Nomi" to txt file ' c:\myfile.txt ' the output file shuld be like this
carlo,marco,pippo, .......etc
max,roberto......etc
can anyone help me
thanks
Re: export data from msaccess to txt file....
You can use the .TransferText function in Access.
VB Code:
Application.DoCmd.TransferText acExportDelim, , "Table1", "C:\Test.txt", True
Re: export data from msaccess to txt file....
thanks RobDog888 for u'r quick answer
sorry bet I forgot to say somyhing before :blush:
I use visual basic 6 :blush:
Re: export data from msaccess to txt file....
Ok, well I seen you were saying export from access as if you were doing it with VBA. No worries.
You can use ADO to connect to the db and read the table into a recordset and then do a save.
VB Code:
'...
oRs.Save "C:\Test.txt", adPersistADTG
Re: export data from msaccess to txt file....
thanks RobDog888 for u'r time, but I'm new in visual basic and what u wrote for, as we saying in italy, is ARABIC ! thanks any way it was kind from u to answer me, I think taht I have to study a lot...
P.S. sorry for my bad english
have a nice time ciao
Re: export data from msaccess to txt file....
Re: export data from msaccess to txt file....
I've allreadt saw it, I have sart learning frome there u know.
I can connect ado to db and read/change/insert data to db, visual db in datagread....
but now I'm blocked here at the end of my prog. I need to export a record of table into txt or msword file, I'm in this step about 4 days I've searched everyware. maybe i need to go sleep and tomorow how knows.... :wave:
thanks
Re: export data from msaccess to txt file....
But if you can do that then you should have a recordset object and just need to save its data if its populated with the needed table.
Re: export data from msaccess to txt file....
ok, I can get the data from the table Nomi, lets say that I got the name "marco and francesco" now from visual basic how can I make a txt file "C:\myfile.txt" and insert the names in to it??
I need to make a txt file and insert any "data" in this format
es
marco,francesco, anna,......etc
I hope that I'm clear
Re: export data from msaccess to txt file....
Quote:
Originally Posted by RobDog888
You can use the .TransferText function in Access.
VB Code:
Application.DoCmd.TransferText acExportDelim, , "Table1", "C:\Test.txt", True
What if this was the other way around??
From a text file to a Database? I know the database must me design with at least 1 table...
Re: export data from msaccess to txt file....
es, you can just use the acImportDelim parameter to specify an import.
Re: export data from msaccess to txt file....
thnkes elgalloloco
lets forget the database ok
All I need is: form my app "in visual basic" to creat a txt file "c:\myfile.txt"and insert 2 value withe comma the output of myfile in this format
value1,value2
and nothing else
can I do that?
Re: export data from msaccess to txt file....
Sure, just use basic File I/O
VB Code:
Open "C:\Test.csv" For Output As #1
Print #1, "Meow, meow, meow!"
Close #1
Re: export data from msaccess to txt file....
ohhh yes thats ok for me just one more question can I do it without the (" ")
if it is possible like this Meow, meow, meow
thanks RobDog888
Re: export data from msaccess to txt file....
Just change the file extension to a txt file. Thecsv places text qualifiers on there by default.
VB Code:
Open "C:\Test.txt" For Output As #1
Re: export data from msaccess to txt file....
hi RobDog888,
U solved my problem thanks now I can go on I wish u a good day :wave:
thanks a lot
asamy