Unconfigured Ad Widget

Collapse

Announcement

Collapse
No announcement yet.

ADO connection to AS400

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • ADO connection to AS400

    Here is a working connection routine that reads an entire file. You will have to play around with the SQL statement to select records. The reason, in this project I loaded the whole file at once(it goes into an array) is for performance. It was a lot slower getting the records as needed by key. You mentioned that the file is in QS36F. Does that mean it's an old System 36 flat file? If thats the case look at VB MID$ function to extract the bytes of data you need. Dim cnn As New ADODB.Connection Dim rst As New ADODB.Recordset Const CnnString = "Provider=IBMDA400;Data Source=192.68.168.1" Dim strSql, strLine As String cnn.CursorLocation = adUseClient ' important against as400 cnn.Open CnnString strSql = "select axloc,axdis#, axname, email from deplall.pcdmastp order by email" rst.Open strSql, cnn, adOpenKeyset 'If no records found then let the user know If rst.BOF Or rst.EOF = True Then 'Close rst & cnn ' Call fnCloseCnn MsgBox "No Dists found", vbInformation, "Not Found" Exit Sub End If Do Until rst.EOF Dim axname1, email1 As String Dim L As Integer axname1 = rst("axname") L = Len(axname1) axname1 = axname1 & Space(30 - L) If rst("email") > " " Then email1 = rst("email") Else email1 = " (no email address)" End If rst.MoveNext Loop Err: rst.Close cnn.Close Set rst = Nothing Set cnn = Nothing End Sub

  • #2
    ADO connection to AS400

    Hi, I have created a form template that would like to link to an iSeries. The part numbers will be entered into a range from B5....B27. Once a part number has been entered I will click a command button that would extract it's value and offset it 2 columns to the right and on the same row. I need help with the linking to the iSeries (AS/400)....the information is in the QS36F library.....PARTDESC...file and PARTNO holds the number I will be entering and FL002 has it's value. Could someone help me with this. Thanks Jaime

    Comment


    • #3
      ADO connection to AS400

      Hi Bill, Thank you for the reply. I will try it and is it okay to let you know if it worked. Thanks Jaime

      Comment

      Working...
      X