Results 1 to 4 of 4

Thread: SQL path parameter

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Posts
    187

    SQL path parameter

    Hi all,

    I am trying to use the follwoing SQL in my VB app which uses the DE;

    INSERT INTO TableB ( Field1, Field2) IN dbServer
    SELECT Field1, Field2
    FROM TableA;

    where dbServer is the path parameter for TableB.

    I keep getting a syntex error and have tried using a second variable dbServerB variable as:

    dbServerB = " ' " & dbServer & " ' "

    and using dbServerB in the SQL.

    I have set the parameter property to adBSTR.


    Any solution would be much appreciated.

    Many Thanks

    Jack

  2. #2
    Hyperactive Member JMvVliet's Avatar
    Join Date
    May 2001
    Location
    Papendrecht, Netherlands
    Posts
    310
    Isn't it true that params only can be used with fields? I thought so, and that could explain this won't work.

  3. #3
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343
    dbServerB = " ' " & dbServer & " ' "
    too many spaces?


    Thought In was in the [i]From part of the Sql??

    Vince

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Posts
    187
    The spaces I used in the " ' " were intentionally to make what I was doing a little clearer (guess not!) instead of using "'", sorry for misleading you.

    Anyhow, I have come up with what is probably an inelegant way of handling this problem;

    With DE
    .rscomTableA.Open
    .rscomTableB.Open

    Do Until .TableA.EOF = True

    .rscomTableB.AddNew
    .rscomTableB.Fields("A") = .rscomTableA.Fields("A")
    .rscomTableB.Fields("B") = .rscomTableA.Fields("B")
    .rscomTableA.MoveNext

    Loop

    .rscomTableA.UpdateBatch
    .rscomTableA.Close
    .rscomTableB.Close

    End With

    This append will only ever have a max of about 40 records, so
    hopefully will be ok for my purposes.

    A more elegant solution would be most welcome.

    Cheers

    Jack

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width