[NEWSboard IBMi Forum]

Threaded View

  1. #8
    Registriert seit
    Feb 2001
    Beiträge
    20.696
    SO einfach ist es nun auch wieder nicht.
    Du musst im VBA-Editor dem Excel über "Extras->Verweise" die Komponente "Microsoft ActiveX Dataaccess 2.7" oder höher zuordnen.

    Dann definierst du

    public function GetPreis(Artikel as string) as double

    static myConnect as new ADODB.Connection
    static myCommand as new ADODB.Command
    static myRecord as new ADODB.Recordset

    with myConnect
    if .state = adstateclosed then
    .connectionstring="DSN=AS400"
    .open
    endif
    end with
    with myCommand
    if .activeconnection is nothing then
    .commandtext="SELECT IDTLPD.DTLPLE FROM LDBSVR1.IBOL01AD.IDTLPD IDTLPD WHERE IDTLPD.DTLNR=?"
    set .activeconnection=myConnect
    endif
    end with
    myCommand(0) = Artikel
    with myRecord
    if .state=adstateclosed then
    .open mycommand
    else
    .requery
    endif
    if .eof = false then
    GetPreis = myRecord(0)
    endif
    end with
    end function

    Dieser Code erhebt jetzt keinen Anspruch auf Vollständigkeit.
    Durch die Static-Definition der Variablen bleibt die Verbindung erhalten, auch wenn die Funktion verlassen wird.
    Last edited by Fuerchau; 21-09-04 at 19:28.
    Dienstleistungen? Die gibt es hier: http://www.fuerchau.de
    Das Excel-AddIn: https://www.ftsolutions.de/index.php/downloads
    BI? Da war doch noch was: http://www.ftsolutions.de

Similar Threads

  1. Telnet / Mocha / Client Access
    By KingofKning in forum IBM i Hauptforum
    Antworten: 7
    Letzter Beitrag: 23-10-06, 17:10
  2. Client Access Disconnect
    By guru30 in forum IBM i Hauptforum
    Antworten: 3
    Letzter Beitrag: 17-10-06, 11:58
  3. Client Access im Hintergrund laufen lassen.
    By boco25 in forum IBM i Hauptforum
    Antworten: 5
    Letzter Beitrag: 20-06-06, 15:51
  4. Vollbild in Client Access
    By .max.0r in forum NEWSboard Windows
    Antworten: 16
    Letzter Beitrag: 11-05-06, 14:47
  5. von SpoolFile nach Excel per Client Access?
    By Koelch400 in forum IBM i Hauptforum
    Antworten: 7
    Letzter Beitrag: 23-05-02, 21:38

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • You may not post attachments
  • You may not edit your posts
  •