Sie sind auf Seite 1von 13

LEARN MS- ACCESS TIPS AND TRICKS - Linking with IBM AS400 Tables Page 1 of 13

Visual Basic to .NET Proven Application Modernization Case Studies


LEARN MS-ACCESS
Visual Basic / VBA tools Create better code faster MS Access and Excel. Free tri
TIPS AND TRICKS Document X Documentation made easy for .NET assemblies, COM, VB, VBA and
Learn advanced MS-Access
programming with VBA Code.
Alerts & Animations, 3D text
wizard, graph charts, MS-
Access security, Internet,
dynamic queries/reports, Mail-
merge. MsgBox with Office
Assistant.

Buy Now! Home Tips and Tricks HOW Tos Security Internet

Downloads Sitemap VB-Tutorial

HOME ABOUT PRIVACY POLICY COMMENTS POLICY Today is Tuesday, March 15, 2011

You Are Here : LEARN MS-ACCESS TIPS AND TRICKS » External Links » Linking With IBM AS400 Tables

3/20/2011
LEARN MS-ACCESS TIPS AND TRICKS - Linking with IBM AS400 Tables Page 2 of 13

Linking with IBM AS400


Tables
Posted By a.p.r.pillai On 19 Jun 2008. Under External
Links Tags: MsaccessLinks

Ads by Google
MS Access Tutorials
AS400
AS400 to Excel
AS400 I Series

We c a n c o nvert IBM iSeries (AS400) DB2 Ta b le


into d Ba se Fo rm a t, download a nd Link o r Im p o rt
into MS-Access Da ta b a ses. The d o w nlo a d ing
p ro c ed ure m ust b e c rea ted a nd run fro m AS400
Menus. If it req uires severa l step s b efo re the
outp ut file b eing tra nsferred to lo c a l d rive then it
c a n b e a uto m a ted w ith Ma c ro Sc rip ts. The key
strokes c a n b e rec o rd ed a nd m o d ified in suc h a
w a y tha t the ta rg et file g o es to a sp ec ific
lo c a tio n on the Lo c a l Ma c hine w ith a
p red efined na m e tha t rem a ins linked w ith the
Microsoft Access Database.

If yo u ha ve suffic ient Ac c ess Privileg es to iSeries


(AS400) Ma in Fra m e Ta b les yo u c a n Link them
d irec tly into your MS-Ac c ess Da ta b a se . We a re
g o ing to lo o k into this m etho d w ith ODBC b a se d
procedure shortly.

No rm a lly, Rep o rts a re g enera ted fro m AS400


a nd p ro vid ed to Users a s Ha rd Co p ies, o r
c o nverted into Rep o rt Sp o o l File in Text Form , if
So ft Co p y is requested for. We c a n d o w nlo a d
this File either in Text fo rm or up loa d it into
Mic roso ft Exc el (m a y no t Pa rse the d a ta
correctly into Num b er or Da te etc .) w ith iSeries
Report Down-Loa der Progra m. AS400 ta b les a lso

http://msaccesstips.com/2008/06/linking-with-ibm-as400-tables/ 3/20/2011
LEARN MS-ACCESS TIPS AND TRICKS - Linking with IBM AS400 Tables Page 3 of 13

c a n b e d o w nlo a d ed d irec tly into Mic ro so ft Exc el


a nd in this p ro c ess, if the num b er o f lines a re
m o re tha n 65535 (the lim ita tio n o f Mic roso ft Excel
Worksheet) it w ill c rea te m o re tha n o ne
Wo rksheet a uto m a tic a lly to a c c o m m o d a te a ll
the data into Excel File.

La ter o n, w e w ill lo o k into a VBA Prog ra m to


up lo a d the AS400 Report Sp oo l File d irec tly into
Mic roso ft Ac c e ss Ta b le, a fter rem o ving Rep ort
Headers and other unwanted lines.

But for now, let us go through the steps for Linking


IBM iSeries DB2 Ta b les into MS-Ac c ess Da ta b a se.
The exa m p le im a g es a re c rea ted fro m
Windows2000 Workstation.

Creating ODBC System DSN

1. Select Sta rt Menu ? – > Settings ? – >


Control Pa nel ? > Administra tive Tools ? ->
double-Click on Data Sources (ODBC).

The ODBC Da ta Source Administra tor


Setting s w ill b e d isp la yed . See the Im a g e
g iven b elo w . The Fo llo w ing Step s w ill w a lk
you through the procedure:

http://goo.gl/fb/mKnOU
a p p lic a tions? Severa l 35 days ago
q ueries o f d ifferent

http://msaccesstips.com/2008/06/linking-with-ibm-as400-tables/ 3/20/2011
LEARN MS-ACCESS TIPS AND TRICKS - Linking with IBM AS400 Tables Page 4 of 13

2. Select System DSN Ta b o n the ODBC Da ta


Source Administrator.

3. Click Add? Butto n to d isp la y a list o f Da ta


Source Drivers.

http://msaccesstips.com/2008/06/linking-with-ibm-as400-tables/ 3/20/2011
LEARN MS-ACCESS TIPS AND TRICKS - Linking with IBM AS400 Tables Page 5 of 13

4. Select Client Access ODBC Driver (32-bit)


fro m the d isp la yed list in the Crea te New
Data Source Control and Click Finish.

http://msaccesstips.com/2008/06/linking-with-ibm-as400-tables/ 3/20/2011
LEARN MS-ACCESS TIPS AND TRICKS - Linking with IBM AS400 Tables Page 6 of 13

5. Typ e a na m e in the Da ta Source na me


Control. I ha ve inserted the na m e myData
as Data Source Name. We have to look for
this na m e w hen w e a ttem p t to link the
Table to MS-Access.

6. Click on the Server Tab.

http://msaccesstips.com/2008/06/linking-with-ibm-as400-tables/ 3/20/2011
LEARN MS-ACCESS TIPS AND TRICKS - Linking with IBM AS400 Tables Page 7 of 13

7. Typ e the sp ec ific iSeries Fo ld er Na m e


w here your d a ta ta b le resid es in the
Library List Control. If more than one Library
is there then separate them with Comas.

8. Put a c hec k m a rk o n the Read-Only


(Select sta tements only) o p tio n und er
Connection Type, to ensure tha t w e ha ve
no intention to m od ify the d a ta in iSeries
Table.

9. Click Apply fo llow ed b y OK Button. The


System Da ta So urc e Na m e myData
a p p ea rs in the System DSN Ta b . See the

http://msaccesstips.com/2008/06/linking-with-ibm-as400-tables/ 3/20/2011
LEARN MS-ACCESS TIPS AND TRICKS - Linking with IBM AS400 Tables Page 8 of 13

image below.

10. Click OK to c lose the ODBC Co nfig ura tio n


Ma in Co ntro l (the Ap p ly b utto n rem a ins
disabled in this case).

Linking to MS-Access Database

1. Open your MS-Access Database.

2. Select File ? -> Get Externa l Da ta ? – > Link


Table or Import Option.

http://msaccesstips.com/2008/06/linking-with-ibm-as400-tables/ 3/20/2011
LEARN MS-ACCESS TIPS AND TRICKS - Linking with IBM AS400 Tables Page 9 of 13

3. Select ODBC Da ta ba ses in the Files of Type


c o ntro l in the Common Dia log Control a nd
Click Link (o r Import) Button a s the c a se
may be.

4. Select Ma chine Da ta Source Ta b o n the


ODBC Co ntro l a nd find the Da ta So urc e
Name myData tha t yo u ha ve c rea ted ,
select it and click OK.

Yo u w ill b e p ro m p ted fo r AS400 User-ID


and password. Key-in your User ID,
Password and Click OK.

A List w ill op en up sho w ing a ll the Ta b le

http://msaccesstips.com/2008/06/linking-with-ibm-as400-tables/ 3/20/2011
LEARN MS-ACCESS TIPS AND TRICKS - Linking with IBM AS400 Tables Page 10 of 13

Na m es a va ila b le in the AS400 iSerie s


Ma c hine Pre fixed w ith the Lib ra ry Na m e
following by a period.

5. Select the Table(s) to Link and Click OK.

The Field s of the selec ted Ta b le w ill b e


d isp la yed sug g esting to hig hlig ht o ne o r
more fields for indexing, if needed.

6. Hig hlig ht the Field (s), if yo u w o uld like to


c rea te a Uniq ue Ind ex fo r the Ta b le,
otherwise Click OK without selecting any.

http://msaccesstips.com/2008/06/linking-with-ibm-as400-tables/ 3/20/2011
LEARN MS-ACCESS TIPS AND TRICKS - Linking with IBM AS400 Tables Page 11 of 13

The selec ted Ta b le w ill b e linked (o r Im p o rted a s


the case may be) into your Database.

If the ta b le rem a ins linked , w henever yo u


a ttem p t to use the ta b le a fter o p ening yo ur MS-
Ac c ess Da ta b a se fo r the first tim e it w ill p ro m p t
fo r the AS400 iSeries UserID a nd Password a nd
after that the login is valid for the current Session.

If yo u d o n’ t w a nt this to ha p p en in the m id d le o f
so m e p ro c essing step s it is b etter to invo ke the
lo g in im m ed ia tely a fter op ening the Da ta b a se.
To do this, create a Query or Form or Report using
the linked iSeries Ta b le tha t o p e ns w ith a n
Autoexec Ma cro o r the Fo rm in Sta rtup , o r even
b etter w rite a VBA ro utine to o p en the linked
ta b le w hic h w ill invo ke the lo g in a nd the User is
p ro m p ted fo r keying in her User ID a nd Password
a t the b eg inning o f the c urrent sessio n itself. This
will take care of the rest of the Session.

http://msaccesstips.com/2008/06/linking-with-ibm-as400-tables/ 3/20/2011
LEARN MS-ACCESS TIPS AND TRICKS - Linking with IBM AS400 Tables Page 12 of 13

Days in Month Function

Finding Consecutive Workdays with Query

Transparent Command Buttons

Colorful Command Buttons

Double Action Command Button

Ads by Google
iSeries
Formation IBM AS400
AS400 RPG Job
AS400 Spool File

2 Responses To “Linking With IBM AS400


Tables”

Anonymous Says:
February 25, 2010 at 4:54 pm

this type of data transfer is not possible in


windows xp. I am getting junk data when
data are being transferred from as400 to ms
access. But same thing is possible in windows
2000. I do not know , what is the reason? Pls
advise me. Amitmohan

A.P.R. Pillai Says:


February 27, 2010 at 2:42 pm

I could not test the procedure under


WindowsXP. Now I am retired from service I
don't have access to AS400 System to try it
out either. But, I don't see why it cannot work
under WindowsXP. Try to insert the ODBC

http://msaccesstips.com/2008/06/linking-with-ibm-as400-tables/ 3/20/2011
LEARN MS-ACCESS TIPS AND TRICKS - Linking with IBM AS400 Tables Page 13 of 13

String into the ConnectStr Property of a new


Query and open the AS400 Table directly
rather than linking it to the database.
Sample ODBC String is given below.

ODBC;DSN=myData;UID=UserID;PWD=Password;TABLE=PAVUP.APC161D

You may read the Article:


http://www.msaccesstips.com/2008/09/source
-connect-str-property-and-odbc/ to take
the ODBC string from your DSN.

Regards,

Trackbacks/Pingbacks
Manufacturing & Logistics It Profiles Visibility
Corporation’s Business Intelligence Technology
Solutions | Software Blog

Leave a Reply

You must be logged in to post a


comment.
« REPAIRING COMPACTING Working with Chart Object
DATABASE WITH VBA in VBA »

Copyright © 2011. All Rights Reserved.


RedMIX Designed By CD Rates
Thanks To Tips and Facts | Video Games | Canvas Art

http://msaccesstips.com/2008/06/linking-with-ibm-as400-tables/ 3/20/2011

Das könnte Ihnen auch gefallen