Welcome to Dream.In.Code
Getting VB Help is Easy!

Join 105,407 VB Programmers for FREE! Ask your question and get quick answers from experts. There are 1,759 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



Download data to an access table from AS400

 
Reply to this topicStart new topic

Download data to an access table from AS400, Need to conecto to an AS400 and transfer data

Wolfguard
post 1 Jul, 2008 - 07:00 AM
Post #1


New D.I.C Head

*
Joined: 1 Jul, 2008
Posts: 2

Hello All,

I have made connection to an AS400, Now, what need to do is to get the information from a Table called PRODUCIDAS which is at the Database CEQYXXX and APPEND the data from the table PRODUCIDAS into an ACCESS TABLE

When I run this application it gives me the following message box error:

40002
S0002: [IBM][iSeries Access ODBC Driver][DB2 UDB]SQL0204-HFA_DATA in CEQYXXX type *FILE not found
CODE

Option Explicit

Dim mConn As rdoConnection

Private Sub Form_Load()

On Error GoTo procerror

Dim sConn As String


If OpenConnection() Then
   MsgBox "connection has been made"
   Call MuestraDatos  ' SUB to download information from the AS400
Else
   MsgBox "Connection has failed"
End If

procexit:
    Exit Sub
    
procerror:
    MsgBox Err.Number & vbCrLf & Err.Description
    Resume procexit
    
End Sub

Private Function OpenConnection() As Boolean
On Error GoTo procerror

Dim sConnect As String

  Set mConn = rdoEnvironments(0).OpenConnection("SERVER")

OpenConnection = True

procexit:
    Exit Function
    
procerror:
    OpenConnection = False
    Resume procexit

End Function

Private Sub MuestraDatos()

Dim sqlHFA As String
Dim rsHFA As rdoResultset
Dim myoLocalDBF as Databasse
Dim myLocalRS as Recordset

set myLocalDBF = EngineDB.Workspace(0).Opendatabase("C:\ODBC_GC_DATA\GC_HFA.MDB")
set myLocalRS = HFA_Data   ' Table to APPEND records to

sqlHFA =  " INSERT INTO HFA_Data (FIELD_1, FIELD_2, FIELD3.....)
               " SELECT FIELD_1, FIELD_2, FIELD_3....and so on FROM PRODUCIDAS"

Set rsHFA = mConn.OpenResultset(sqlHFA, rdOpenForwardOnly, rdConcurReadOnly, rdExecDirect)

End Sub
User is offlineProfile CardPM

Go to the top of the page


jayman9
post 1 Jul, 2008 - 09:19 AM
Post #2


Student of Life

Group Icon
Joined: 26 Dec, 2005
Posts: 6,237



Thanked 21 times

Dream Kudos: 500

Expert In: C#, VB.NET, Java

My Contributions


The error message is stating that it cannot find the database.

In your ODBC data source, did you specify the correct default library on the AS400?
User is offlineProfile CardPM

Go to the top of the page

Wolfguard
post 1 Jul, 2008 - 10:01 AM
Post #3


New D.I.C Head

*
Joined: 1 Jul, 2008
Posts: 2

The HFA_data is the LOCAL table where I am going to APPEND the data from PRODUCIDAS

I don't know how to do that and I thought that by declaring then as I did was the right way

Could you help me?
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 8/20/08 05:15AM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month