We help IT Professionals succeed at work.

DoCmd.TransferText

ytgprasad
ytgprasad asked
on
hi guys,
Pls help me regarding "DoCmd.TransferText"

I have read the command specification and it is like this:

DoCmd.TransferText [transfertype][, specificationname], tablename, filename
u[, hasfieldnames][, HTMLtablename]

My difficulty is with the second parameter. In the msdn site it says :
"
specificationname
 A string expression that's the name of an import or export specification you've created and saved in the current database.
 This argument is required for fixed-width text files. For delimited text files and Microsoft Word mail merge data files, you can leave this argument blank to select the default import/export specifications.
"
My problem is how do I create these specification and use them. Step by step description is fully appreciated.
Thank you,
Comment
Watch Question

Commented:
If you import the file once using the import wizard, you have the possibility to save the specification with the [advanced...] button on the last wizard page.

Clear ?

Nic;o)

Author

Commented:
hi nico5038,
I am not very clear.Where is this specification stored.
Thank you,
I created this example for another questioner.  This example is for exports, but, you should get the jist of it.
http://home.earthlink.net/~dilligaffuq/AccessExample/index.html

One thing you need is to have the import/export wizard installed.  If you don't have it installed, rerun the setup program and install them.

If this solves your problem, kick the points to Nic since he beat me to the answer.  I am just providing a link I built a while back.

dill

Author

Commented:
hi dill,
I am getting a better picture now. I have two doubts.

1) where do i need to store this file so that my docmd.transfertext works.
2) Do I need to give the .txt extension also in the method call.

Thank you,
"1) where do i need to store this file so that my docmd.transfertext works."

By this file, do you mean the specification?

If so, you don't get a choice on where to store it.  Unless they changed this past Access97 and I don't know.

If you mean your actual text file, you can store it anywhere.


"2) Do I need to give the .txt extension also in the method call."

Again, if you mean the specification, you put here the exact spec name you used.

If you mean your actual text,file, you put here the whole name.  ie:  "c:\data\file.txt"

dill

Commented:
Did you try the wizard and pressed the Advanced button?
After possible changes, you're able to use the SaveAs button to store the specification.

Nic;o)
Co

Commented:
I had problems using the specifications in Access, so I started to use the schema.ini
This works good now for my text files, better then specifications, at least that's what I think.

I think it is better because I have more control over it. I can decide where to store the schema.ini file, and if needed I can change it programmatically. All things you can not do with a specification.

Problem is: due to an (admitted) mistake by microsof. You can only use the schema.ini by using VBA-code.

Have a look here:
http://support.microsoft.com/support/kb/articles/Q155/5/12.ASP
http://support.microsoft.com/directory/article.asp?ID=KB;EN-US;Q210073
http://support.microsoft.com/directory/article.asp?ID=KB;EN-US;Q241477

I now have a little experience using these schema.ini's
so if you want to know more about using them just let me know by dropping a comment in here.

Also look at this: it was the reason I started to use schema.ini's
http://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=msaccess&qid=20143458

HTH,

Co

Author

Commented:
hi everyone,
I have now clear understanding of where specs will be. Now I can see the specs existing in the database. But I am not able to update them. Any clues.
Thank you,

Author

Commented:
I am using Access 2000
The way I do it in Access97 is to go thru the process of a manual transfer.  Then when at the page where you can update the spec, click the Save As button.

dill

Author

Commented:
Got it guys. Thanks a lot. I am clear now. What I am confused now is..to whom should I give points....any suggestions or comments

Commented:
You can drop a 0 point Q at Customer support to do a refund and then you can split the points as you please.
Just paste a link to this Q there (see link top left).

Glad it's working.

Nic;o)

Author

Commented:
Thankx for ur timely help

Explore More ContentExplore courses, solutions, and other research materials related to this topic.