Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2004
    Location
    Mexico
    Posts
    8

    Question Unanswered: displaying fields from 2 tables in 1 datagrid (VB6)

    hey...

    I have a question:

    Can I display information about fields from 2 separate database tables in 1 datagrid control?

    the thing is one of my tables is Transactions, which is linked to Products through the field ProductID. I don´t want the user to see the ProductID field, but the ProductPartNumber field, which is in the Products table, and not on Transactions. Confusing??? hope not...

    anyway, can it be done? and if so, how?

    thanx a lot...

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Piece of cake! You should be able to use something like:
    Code:
    SELECT
       t.col1
    ,  p.ProductPartNumber
       FROM transactions AS t
       JOIN Products AS p
          ON (p.ProductID = t.ProductID)
       WHERE  --  you figure this part out
    The user won't even know that there is a ProductID column, much less what its value might be!

    -PatP

  3. #3
    Join Date
    Apr 2004
    Location
    Mexico
    Posts
    8
    hey, PatP.

    thanx a lot for answering so soon!

    look, I don´t know much about VB, so please bear with me:
    the SQL query you wrote should be on the recordsource property of the ADOdc control?


    thanx.

Posting Permissions

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