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

Importing from AS400 to Excel

Status
Not open for further replies.
Joined
Mar 4, 2003
Messages
47
Location
US
I'm trying to import data from an AS400 to Excel. I can get the data to come in fine, except for dates. I just get a number that will not convert to a date. I couldn't find anything in the options that would preserve the date format during the import.

I have a feeling I'm missing something pretty simple. Thanks in advance for any help you can offer.
 
philwes83170,

Do not work with AS400, but dates can be a bit of a pain.

What is your date format in the text file that you are trying to import into Excel as a date?

Some sample functions you might be able to use to import the data..

An optional approach would be to import from the text file using ADO Recordset, see:

loading a recordset from textfile
thread329-509150 refs of interest include:

Pulling data from Access into another MS App (via DAO)

VBScript & Excel

Rendering the results of an Access Database in Excel

generating excel sheets from access
thread181-472093 DAO to run a query in Access and return results to excel
thread707-510949 to Excel then format the spreadsheet using VBA
thread705-511927 this helps.
DougCranston
 
philwes81370,

Its time to read up on the date formats for the AS400. Once you know what format they're using, it should be fairly straightforward to code up a conversion routine.

Can you give us a sample of what a date comes in as, and what it should be?

Paul
 
if your date looks like this...


20030328

then you can can add a col to convert it


in new col...assuming your as400 date is in col. A
then in col B ...format the column as date
then paste this formula.


=DATEVALUE(MID(A1,5,2)&"/"&RIGHT(A1,2)&"/"&LEFT(A1,4))

fill down


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top