CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2001
    Location
    Texas
    Posts
    1

    ADO-Dataenvironment Question

    I use the following instructions to attach to an
    Access database table using ADO and the Data environment:

    DataEnvironment1.phone1
    Set rs = DataEnvironment1.rsPhone1

    How can I change "Phone1" in these instructions or build these instructions at runtime to reflect a different table name(the table name is being selected from a long list of table names at runtime)

    Thanks---Tennisnet


  2. #2
    Join Date
    Sep 2000
    Location
    CA
    Posts
    25

    Re: ADO-Dataenvironment Question

    Instead of using a DataEnvironment command to open your recordset, try to open the recordset dynamically using the DataEnvironment connection (DataEnvironment1.cnn) like this:

    set rs = DataEnvironment1.cnn.Execute("SELECT * FROM " & strYourVariable



    where strYourVariable is a table name in your database.
    Alternately, you can define a command for each table, and then use a select case to determine which command to use at run time.

    Hope this helps

    Jason



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

Featured