DoCmd.TransferText

daievans

Registered User.
Local time
Today, 05:21
Joined
Apr 3, 2013
Messages
75
The following code works perfectly

Code:
DoCmd.TransferText acImportFixed, strImpSpec, strTable, strPathFile, boolHasFieldNames

If I replace the "acImportFixed" with a string function witht he same value, it fails with an Error 13 Type Mismatch

Code:
DoCmd.TransferText strTextTransfer, strImpSpec, strTable, strPathFile, boolHasFieldNames

The strvariable is held in a table and is text in the table.

Anyone got any thoughts on how my piloting is crashing this thing?
 
Sure, the ac constants are all, or mostly all Long Integers. Set a breakpoint on the working version and hover over that argument and you should see the numerical value.
 
Seems like it would be pretty easy to test. ;)
 
If I replace the "acImportFixed" with a string function witht he same value, it fails with an Error 13 Type Mismatch


that's the thing - acimportfixed is not a stirng. it's a numerical constant. you would have to replace it with the numerical value, not a string.

it's hard to see why it matters, it's intrinsic to all versions of access, i think - and not something you might need to specifically replace with a numeric reference.
 
I'm happy to report that replacing the AcTextTransferType with the appropriate integer works a treat.

In addition to thanking all my helpers, I'm thinking of patting myself on the back - but somehwere deep in the psyche I can hear John Handel (Dad) reminding me "David, self-praise is no recommendation!" :o
 
No problem. As a dad myself, I'm tempted to say dads are always right, but... :p
 
Could you post the result with the integer? Just in case this question comes up again. Great job solving it!
 
See the link to MSDN in an earlier message and attached Excel file.


This was useful for me as I use a table of variables to process a large number of file variations we encounter. In my table I "lookup" to the table below, binding only to the column containing the integer.

Attempts at writing for example, acImportFixed as a strvariable were fruitless for reasons cited by the contributors. :cool:
 

Attachments

Last edited:

Users who are viewing this thread

Back
Top Bottom