DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Alban GOBIN Guest

    Create queries trough code


    I've some troubles on writing a code that creates 450 Access Queries from
    a txt file that contains their SQL syntax...
    I'd like that to run automaticly without the user's intervention.
    Please help me to find procedures and syntaxes to do that because I'm a beginner
    in that domain.

    Thanks and please forgive my english speech.

  2. #2
    Mike Hutton Guest

    Re: Create queries trough code


    This might serve as a good starting point...You can run it in an Access module.
    (In Access97 anyway)
    _____________________________________________________________

    Sub AddQueries()
    Dim QD As QueryDef
    Dim SQL_From_Text As String
    Dim I As Integer

    Open "c:\mytext.txt" For Input As #1

    Do While Not EOF(1)
    Input #1, SQL_From_Text
    Set QD = New QueryDef

    QD.Name = "NewQuery " & I
    QD.SQL = SQL_From_Text

    CurrentDb.QueryDefs.Append QD
    I = I + 1
    Loop

    Close #1
    End Sub


    "Alban GOBIN" <lgobin@brutele.be> wrote:
    >
    >I've some troubles on writing a code that creates 450 Access Queries from
    >a txt file that contains their SQL syntax...
    >I'd like that to run automaticly without the user's intervention.
    >Please help me to find procedures and syntaxes to do that because I'm a

    beginner
    >in that domain.
    >
    >Thanks and please forgive my english speech.



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links