Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Is there any way to run multiple SQL commands in Access 2003

Discussion in 'Information Technology' started by Rod, Jul 28, 2006.

  1. Rod

    Rod
    Expand Collapse
    Guest

    I want to be able to run multiple SQL commands in Access 2003 without having
    to write a bunch of VB code or the cumbersome stored proceedures method using
    stored proceedures in a upsized Access database.

    Every other database software I have used can do this easily but Microsoft
    Access seems to what you to be a programmer to do this.

    Grumble
     
  2. Loading...


  3. Albert D.Kallal

    Albert D.Kallal
    Expand Collapse
    Guest

    Just build your queries, an save them. (you have to save them some
    where!!!!)

    To run them, just click on one after another....

    If clicking is too much exercise, and too hard, then create a small code
    routines. After all, if a person can figure out how to write and need to run
    "several" sql statements, then I can't imagine this is any more difficult
    then write a few lines of code?

    Simply create a code module, and go

    currentdb.Execute "query1"
    currnetdb.Execute "query2"
    etc....

    I mean, you can also type the raw sql from the debug window, such as:

    currentdb.execute "update tblCustomers set NewYear = true"

    or, you can execute the name of saved query:

    currentdb.Execute "query1"

    You *can* type the sql into your code module, such as:

    dim s as string

    s = "update tblCustomers set NewYear = True"
    currentdb.Execute s

    s = "bala abla abal"
    currentdb.Execute s

    The above is no more work then typing in a bunch of statements into a text
    file. And, often those "other" systems you talked about do need a "go"
    command, or something else between each statement. The above is not any more
    work. As mentioned, the prefer approach is to save the queries, and then use
    code to run them as per the first example.....


    --
    Albert D. Kallal (Access MVP)
    Edmonton, Alberta Canada
    pleaseNOOSpamKallal@msn.com
    http://www.members.shaw.ca/AlbertKallal
     
  4. aaron.kempf@gmail.com

    aaron.kempf@gmail.com
    Expand Collapse
    Guest

    I use a concept called chapters

    so that i write a query; and then i dont need to DO ANYTHING ot get it
    to run.

    I just loop through all my queries looking for queries named QF01, and
    thern QF02, etc

    pretty straight; i wish i could share more of my code; but it's more
    trouble than it's worth

    -Aaron




    Albert D.Kallal wrote:
    > Just build your queries, an save them. (you have to save them some
    > where!!!!)
    >
    > To run them, just click on one after another....
    >
    > If clicking is too much exercise, and too hard, then create a small code
    > routines. After all, if a person can figure out how to write and need to run
    > "several" sql statements, then I can't imagine this is any more difficult
    > then write a few lines of code?
    >
    > Simply create a code module, and go
    >
    > currentdb.Execute "query1"
    > currnetdb.Execute "query2"
    > etc....
    >
    > I mean, you can also type the raw sql from the debug window, such as:
    >
    > currentdb.execute "update tblCustomers set NewYear = true"
    >
    > or, you can execute the name of saved query:
    >
    > currentdb.Execute "query1"
    >
    > You *can* type the sql into your code module, such as:
    >
    > dim s as string
    >
    > s = "update tblCustomers set NewYear = True"
    > currentdb.Execute s
    >
    > s = "bala abla abal"
    > currentdb.Execute s
    >
    > The above is no more work then typing in a bunch of statements into a text
    > file. And, often those "other" systems you talked about do need a "go"
    > command, or something else between each statement. The above is not any more
    > work. As mentioned, the prefer approach is to save the queries, and then use
    > code to run them as per the first example.....
    >
    >
    > --
    > Albert D. Kallal (Access MVP)
    > Edmonton, Alberta Canada
    > pleaseNOOSpamKallal@msn.com
    > http://www.members.shaw.ca/AlbertKallal
     

Share This Page