Results 1 to 6 of 6
  1. #1
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Order of the output results in a query (2003)

    Is there a way to have the qtotAnswers query Question column(please see attached mdb) respect the order in which the data is presented in the original Question columm in the tblSurveyResults table?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Order of the output results in a query (2003)

    Records in an Access table do not have an intrinsic order. If you want a query to return the records in a specific order, you must add a field to the table on which the records can be sorted. But is't not exactly clear to me what you want, since your query is a totals query that will combine the values of several records.

  3. #3
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Order of the output results in a query (2003)

    Thank you for your suggestion Hans, I've prepared a function(CreateResultsTable) that fills the required ID sorting field. My problem now is that, when I launch said function, I get the error message:
    Error No: 3061; Description: Insufficient parameters; expected 1.
    relevant to the line
    Set rstSource = dbs.OpenRecordset(strSourceTable)

    Is it possible to feed a parameter query(QPersonale) to an OpenRecordset method?

  4. #4
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Order of the output results in a query (2003)

    What you can do is to feed the parameter to the query in a querydef then open the recordset via the querydef.
    eg.
    Set qdf = QueryDefs("QPersonale")
    qdf.Parameter("[forms]![prev]![cgior]") = [forms]![prev]![cgior]
    Set rstSource = qdf.OpenRecordset()

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Order of the output results in a query (2003)

    You can replace that line with
    <code>
    Dim qdf As DAO.QueryDef
    Set qdf = dbs.QueryDefs(strSourceTable)
    qdf.Parameters("[forms]![prev]![cgior]") = [Forms]![Prev]![CGior]
    Set rstSource = qdf.OpenRecordset
    </code>
    The code runs without errors with that modification.

  6. #6
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Order of the output results in a query (2003)

    That's a very clever workaround. Thank you guys <img src=/S/clapping.gif border=0 alt=clapping width=19 height=23>

Posting Permissions

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