Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB 6
Pro VB 6 For advanced Visual Basic coders working in version 6 (not .NET). Beginning-level questions will be redirected to other forums, including Beginning VB 6.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old April 19th, 2004, 12:17 PM
Registered User
Join Date: Mar 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default ADO - Updating two tables?

I am trying to figure out how I can display data on a VB form that comes from several tables and can be updated. I was using an ADO data control, but it is causing me problems when I join tables.

Basically I want to display and edit...


Does anyone have any idea how I could do this? Table design is below.

[u]Table1 - Customer</u>
Customer_ID (PK)

[u]Table2 - Phase</u>
Customer_ID (PK) - FK to Table1
Phase (PK)

[u]Table3 - Type</u>
Type_ID (PK)
Old April 23rd, 2004, 01:31 AM
Authorized User
Join Date: Mar 2004
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts

You should use a mshflexgrid not linked to any adodb control. You make a recordset from your joined tables and than fill the grid from the recordset row by row

        With rsTemp
            i = 1
            While Not .EOF

                hfgRecords.Rows = i + 1

                hfgRecords.TextMatrix(i, 0) = .Fields("Name").value & ""

                hfgRecords.TextMatrix(i, 1) = .Fields("Phase").value & ""

                hfgRecords.TextMatrix(i, 2) = .Fields("StartDate").value & ""

                hfgRecords.TextMatrix(i, 3) = .Fields("EndDate").value & ""
                hfgRecords.TextMatrix(i, 4) = .Fields("TypeDesc").value & ""

                i = i + 1

        End With

Lucian Preda
Old May 19th, 2004, 05:39 AM
Authorized User
Join Date: Nov 2003
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts


if you are familiar with SQL ("UPDATE tablename SET field = value,.."), you can build the SQL statement in form of a string and then assign it to a ADO command & execute it.

This is, in my opinion, the most straightforward and controllable way.
It also works with any SQL dialect (Oracle, MySQL, Sybase etc.)


Similar Threads
Thread Thread Starter Forum Replies Last Post
Updating Tables Brendan Bartley Access 1 December 20th, 2006 10:42 AM
Huge problem updating FoxPro with ADO recordset erankin42 Classic ASP Databases 5 October 18th, 2004 03:08 PM
Updating database records in ASP/ADO aismail3 Classic ASP Databases 5 September 16th, 2004 11:10 PM
ADO and updating records tcarnahan Access 2 June 11th, 2004 09:26 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.