Create queries trough code


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Create queries trough code

  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.



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


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center