Results 1 to 4 of 4

Thread: Different Tables

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2000
    Location
    Burbank
    Posts
    3

    Unhappy

    I got a PROBLEM about ADO ...
    Let's put this scenario:

    I got the following Tables:

    o Clients
    o Orders
    o Details
    o Credit
    o Payments

    Also I got a form with SSTAB with all the text boxes Required to bind info or make data entry.

    So ... Every time when the user open his application, He gonna get all the clients Assing to him.

    The problem is about how to update, add information but to the different tables ... So I'm confused about how I can get this done.

    Any recomendation is Welcome


    Thanx
    U Little Piece of Code!!!!

  2. #2
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105
    Make a data control, to bind, for every table you need to get/put data to (if you're using bound controls) _or_ retrieve the data from each table and populate the unbound fields...

  3. #3

    Thread Starter
    New Member
    Join Date
    Sep 2000
    Location
    Burbank
    Posts
    3

    Smile

    Ok ... Thanks for the recommendation, anyway do u have a little example to get clear the idea?

    The other thing I forgot to mention is, I'm using SQL server 7, Stored procedures will help in this case?

    Gracias

    [Edited by Kristo on 09-19-2000 at 07:01 PM]
    U Little Piece of Code!!!!

  4. #4
    Fanatic Member HaxSoft's Avatar
    Join Date
    May 2000
    Location
    Ohio
    Posts
    593
    If you have info in some variables, which we call strSomething:

    Code:
    Dim db As Database
    Dim rs As Recordset
    
    Set db = OpenDatabase("mydb.mdb")    ' open database
    Set rs = db.OpenRecordset("Clients") ' open table
    
    With rs
      '*** Add a record...
      .Add
      !FirstName = strFirstName ' set FirstName field in table
      !LastName = strLastName
      !PhoneNo = strPhoneNo
      strID = !ID  ' << get ID from new record (counter field)
      .Update                   ' << store the data
    End With
    
    rs.Close
    Set rs = db.OpenRecordset("Orders")
    
    With rs
      '*** Add record to order...
      .Add
      !OrderDate = Now()    ' order date
      !CustomerKey = strID  ' Foreign key to Clients table
      '
      ' more stuff here
      '
      strID = !ID ' get order ID if you need it
      .Update
    End With
    
    rs.Close  ' close table and DB...
    db.Close
    Set rs = Nothing  ' not really needed I think, but still...
    Set db = Nothing
    This is an example using DAO ... ADO is probably pretty much the same.

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