Passing Query Parameters in Sub-Queries

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default Re: Passing Query Parameters in Sub-Queries

    coder23 wrote:
    > I have a Query in Access titled "SR_Control"
    >
    > I know you can pass values from ASP to the Query with:
    > SQL = "SR_Control '1/1/2004', '5/1/2004', 'Blue'"
    '1/1/2004' ???
    Shouldn't it be #'1/1/2004# ? Or are these Text parameters?

    > rs1.Open SQL, cn1, etc... etc....
    >
    > ... but is there a way to call the Query and Pass values to it from
    > an SQL string? for example: SQL2 = "SELECT * INTO test2 FROM
    > (SR_Control '1/1/2004', '5/1/2004', 'Blue');" - or -
    > SQL2 = "SELECT * INTO test2 FROM (" & SQL1 & ");"
    >
    > (the attempts above return errors.)
    You need to create another saved query for this:

    In Access, create a query with this sql:
    SELECT * INTO test2 FROM [SR_Control]

    Test it and verify that you get prompted for the parameter values.

    Save it, calling it something like qCreateTableFromSR_Control. then call it
    in ASP instead of SR_Control.

    Bob Barrows


    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.


    Bob Barrows [MVP] Guest

  2. Similar Questions and Discussions

    1. Passing Parameters To CFC
      I am testing how to return data from a CFC within Flash Forms. I have a simple <cfselect> tag that will hold data returned from a CFC. This CFC...
    2. Query of Queries on query New type query
      In CF5 we have a page that creates a query, using queryNew and querySetCell and the like, we then used dbtype="query" and gave it's name so we could...
    3. Passing Queries
      This is the first time I am posting here so I hope nobody panics if this is the wrong section for this question...... Anyway, I have created a...
    4. passing parameters
      Hi Michael, I think you want to modify the links in web control programmatically. You can add several Hyperlink controls to the user control,...
    5. Alternate for passing parameters for dbase query?
      And perhaps this could give you some ideas about avoiding querystrings: ASP Design Tips - Post Back Page...
  3. #2

    Default Re: Passing Query Parameters in Sub-Queries

    thanks Bob. that definitely works, but I wanted to use the SQL String because I needed to specify the name of the table.

    SQL2 = "SELECT * INTO " & tableName & " FROM (SR_Control '1/1/2004', '5/1/2004', 'Blue');

    is there an easy way to do this


    ----- Bob Barrows [MVP] wrote: ----

    coder23 wrote
    > I have a Query in Access titled "SR_Control
    >> I know you can pass values from ASP to the Query with
    > SQL = "SR_Control '1/1/2004', '5/1/2004', 'Blue'
    '1/1/2004' ??
    Shouldn't it be #'1/1/2004# ? Or are these Text parameters

    > rs1.Open SQL, cn1, etc... etc...
    >> ... but is there a way to call the Query and Pass values to it fro
    > an SQL string? for example: SQL2 = "SELECT * INTO test2 FRO
    > (SR_Control '1/1/2004', '5/1/2004', 'Blue');" - or
    > SQL2 = "SELECT * INTO test2 FROM (" & SQL1 & ");
    >> (the attempts above return errors.
    You need to create another saved query for this

    In Access, create a query with this sql
    SELECT * INTO test2 FROM [SR_Control

    Test it and verify that you get prompted for the parameter values

    Save it, calling it something like qCreateTableFromSR_Control. then call i
    in ASP instead of SR_Control

    Bob Barrow


    --
    Microsoft MVP -- ASP/ASP.NE
    Please reply to the newsgroup. The email account listed in my Fro
    header is my spam trap, so I don't check it very often. You will get
    quicker response by posting to the newsgroup



    coder23 Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139