TransferText Macro and truncating a field number

G

Guest

Hello,

I have a txt file I am importing with the TransferText function in a macro.

However, I would like to truncate the field while importing before loaded
into the table or run a query to modify the filed in the table after
importing.
I would like to truncate the first 3 digits and the last 2 digits of a 14
character number.

I am unsure of the code to do this and am looking for some suggestions.

Thank you!
 
G

Guest

Kent said:
Hello,

I have a txt file I am importing with the TransferText function in a macro.

However, I would like to truncate the field while importing before loaded
into the table or run a query to modify the filed in the table after
importing.
I would like to truncate the first 3 digits and the last 2 digits of a 14
character number.

I am unsure of the code to do this and am looking for some suggestions.

Thank you!
 
G

Guest

Ooops, I think I clicked post before I wrote anything.

Whether you import the text file or link to it, you will need an append
query to do this. My preference would be to link to it if possible. I don't
import anything I don't intend to keep.

In the query, use a calculated field on the field you want to truncate with
the following formula:

ShortVers: Mid([LongField], 4, 9)
 
G

Guest

Thanks for the quick response. I tried that calculated field replacing the
LongField with my field name however it does not seem to append any records.

Klatuu said:
Ooops, I think I clicked post before I wrote anything.

Whether you import the text file or link to it, you will need an append
query to do this. My preference would be to link to it if possible. I don't
import anything I don't intend to keep.

In the query, use a calculated field on the field you want to truncate with
the following formula:

ShortVers: Mid([LongField], 4, 9)


Kent said:
Hello,

I have a txt file I am importing with the TransferText function in a macro.

However, I would like to truncate the field while importing before loaded
into the table or run a query to modify the filed in the table after
importing.
I would like to truncate the first 3 digits and the last 2 digits of a 14
character number.

I am unsure of the code to do this and am looking for some suggestions.

Thank you!
 
G

Guest

I think I have got this to run properly. Thank you.

Kent said:
Thanks for the quick response. I tried that calculated field replacing the
LongField with my field name however it does not seem to append any records.

Klatuu said:
Ooops, I think I clicked post before I wrote anything.

Whether you import the text file or link to it, you will need an append
query to do this. My preference would be to link to it if possible. I don't
import anything I don't intend to keep.

In the query, use a calculated field on the field you want to truncate with
the following formula:

ShortVers: Mid([LongField], 4, 9)


Kent said:
Hello,

I have a txt file I am importing with the TransferText function in a macro.

However, I would like to truncate the field while importing before loaded
into the table or run a query to modify the filed in the table after
importing.
I would like to truncate the first 3 digits and the last 2 digits of a 14
character number.

I am unsure of the code to do this and am looking for some suggestions.

Thank you!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top