Global Variable at Runtime

  • Thanks for the kind words Mike.

    Well Im back at it. I have made a lot of progress! I have opened a recordset based on a query to the Progress database using the Global Variable.

    Now I want to append the recordset rows to my SQL table (the progress and SQL tables are identical and I am bringing all rows over).

    cnnSQL.Open "DSN=TM SQLServer Syteline_test"

    theSQL = "INSERT matltran VALUES rst???"

    Set cmd.ActiveConnection = cnnSQL

    cmd.CommandText = theSQL

    Do Until rst.EOF

    cmd.Execute()

    rst.MoveNext

    Loop

    How do I reference an entire row of values in a recordset? Can it be done or does each field have to be spelled out? I can't seem to find any way to do this.

    Thanks for the help!

  • Hi Jonathan,

    How about 'INSERT mytargettable SELECT * FROM mysourcetable'...the problem you have to watch out for though is that you can get type mismatch errors if you don't list out the individual fields. The best form is to list the fields both in the INSERT part of the statement and in the SELECT...FROM portion of the statement. You can certainly give the INSERT...SELECT * FROM route a try and see how it works for you...

    hth,

    Michael

    Michael Weiss


    Michael Weiss

  • Sorry for the long delay in responding! I hope you have gotten an answer or figured out a solution long before now. As far as i know, there is no way to reference an entire row per se...I usually list out each field...you can use a loop though and do something like:

    Dim fld

    Do Until rst.EOF

    For each fld in rst.Fields

    somevariableorwhathaveyou = fld.Value & chr(9)

    Next

    rst.Movenext

    Loop

    Hope this helps although I am sure it is too late! My apologies...

    Michael

    Michael Weiss


    Michael Weiss

Viewing 3 posts - 16 through 17 (of 17 total)

You must be logged in to reply to this topic. Login to reply