Results 1 to 2 of 2

Thread: Tables (VB6)

  1. #1
    Lounger
    Join Date
    Apr 2001
    Location
    Rockvale, Tennessee, USA
    Posts
    42
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Tables (VB6)

    Can someone show me how to do the following:

    Sample Project:
    2-Tables, CarsPeopleDrive and Cars. Table "CarsPeopleDrive" has 2-columns, Names and Cars where column [Cars] reference the Models Column of Table "Cars"
    1-Form with2- ComboBoxes, 1 to display current record of Names and 1 to display the corresponding selected record from a dropdown list of Models from Table "Cars".

    I've seen something similar in Access 2000, but I need to create the same effect in VB.

    Thanks, John
    Attached Files Attached Files

  2. #2
    Platinum Lounger
    Join Date
    Dec 2000
    Location
    Queanbeyan, New South Wales, Australia
    Posts
    3,730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Tables (VB6)

    John,

    I've picked out a sample of my code from an Excel application- but it's very similar to what vyou would do in VB6, populating a Form.

    <pre>Option Explicit
    Public strSQL As String
    Public rstRecordSet As ADODB.Recordset
    Public cnnConnection As ADODB.Connection

    Sub PopulateData

    Dim j as Integer
    Call setConnection

    strSQL = "select Model, Licence, OwnerName " & _
    "from People, Autos where Autos.OwnerID = People.ID"
    j = 0
    With rstRecordSet
    .Open Source:=strSQL, ActiveConnection:=cnnConnection, _
    CursorType:=adOpenForwardOnly, LockType:=adLockReadOnly
    Do While Not .EOF
    j = j + 1
    Sheets("OwnerList").Cells(j, 2) = .Fields("OwnerName") & _
    Subway Belconnen- home of the Signboard to make you smile. Get (almost) daily updates- follow SubwayBelconnen on Twitter.

Posting Permissions

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