Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: Tables

  1. #1
    New Coder
    Join Date
    Jul 2002
    Location
    Malaysia
    Posts
    61
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Tables

    Dear Sir,


    Referes to VB 6.0
    I have create a database file called "ar.mdb" and in the "ar.mdb" i have create several table called "code", "CCategory" and etc.
    How can I access various tables in a database file to a form.
    Below coding will occur run time error. Do you know the coding.

    Private Sub Form_Load()
    SQL = "SELECT * FROM CCategory ORDER BY CusCat"
    SQL = SQL & "SELECT * FROM SCategory ORDER BY SalesCat"
    SQL = SQL & "SELECT * FROM Code ORDER BY CardCode"
    Set RS = gDB.OpenRecordset(SQL)


    Thanks,

    Xaing

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It errors because by the time you read the OpenRecordset call the text of your SQL looks like this:

    SELECT * FROM CCategory ORDER BY CusCatSELECT * FROM SCategory ORDER BY SalesCatSELECT * FROM Code ORDER BY CardCode

    You need to terminate each select with a semicolon (;) and then you should get a recordset object containing three recordsets.
    Check out the Forum Search. It's the short path to getting great results from this forum.


  •  

    Posting Permissions

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