Results 1 to 2 of 2

Thread: Sql

  1. #1
    Join Date
    Mar 2004
    Posts
    128

    Unanswered: Sql

    Hey,
    How I can do the following in VB using RunSql:
    T1 is the first table and it's fields are O,S,C
    T2 is the second table and it's fields are F1,F2,F3

    My Problem that I get the T1 and T2 as Tabledef variable to the function and I don't know how can I get their fields in the runsql command

    UPDATE T1, T2 SET T1.O = [T2].[F1], T1.S = [T2].[F2], T1.C = [T2].[F3];

  2. #2
    Join Date
    Mar 2004
    Location
    www.scirocco.ca
    Posts
    346

    Re: Sql

    In VB you variables must be sourround by quotes to build your query string as will be seen by access. i.e.

    A DELETE Statement where the table name is variable

    DELETE Table.Field1, Table.Field2, Table.Field3, Table.Field4 FROM Table;

    becomes in VB or VBA

    "DELETE " & strTableName & ".Field1," & strTableName & ".Field2, " & strTableName & ".Field3, " & strTableName & ".Field4 FROM " & strTableName & ";"
    http://www.scirocco.ca/images/banner...occobanner.gif

    Download for FREE the ADO/DAO Data Controls that makes life EASIER developing database applications in: VB, FoxPro, Access, VC++, .NET etc... Navigate, Add New, Delete, Update, Search, Undo and Save your changes. Supports Disconnected Recordsets and Transactions!

    Or try our Ask An Expert service to answer any of your questions!

Posting Permissions

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