Results 1 to 14 of 14
  1. #1
    Join Date
    Aug 2010
    Posts
    18

    Unanswered: How can we list all fields of different tables on a report?

    That means "Run SQL Query from VBA and store result in a text box on report"
    I have many different tables (one table = one product = many transactions). I want to creat a reports list all fiels of a table, depends on transaction (OrderID) and we will colect the concerned row (one transaction = one row).
    For example:
    A table (consisting of OrderID1, A'1, A'2, A'3, A'4 fields
    OrderID2, A''1, A''2, A''3, A''4 fields...)
    How can I list it on the report:
    - report.OrderID = table.OrderID
    Thanks
    Last edited by elepig; 08-02-10 at 02:38.

  2. #2
    Join Date
    Aug 2010
    Posts
    18
    please help me. I need it urgently.
    Thank so much.

  3. #3
    Join Date
    Aug 2010
    Posts
    18
    so many views and no reply so sad

  4. #4
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    Perhaps you can reword the question. I'm not sure what it is you want, and apparently nobody else is either. Have you tried the report wizard?
    Paul

  5. #5
    Join Date
    Aug 2010
    Posts
    18
    I will rewrite my question. It's very simple.
    "How can we put Query result into a textbox on a Report?"
    my A query has A1 field, A2 field, A3 field"

  6. #6
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    First option, base the report on the query (the query is the report's record source). If that's not possible, use DLookup() to get a value from the query, ie a textbox control source of:

    =DLookup(...)
    Paul

  7. #7
    Join Date
    Aug 2010
    Posts
    18
    can I list field names? I need to list the SQL (instead of make a query) result into a textbox
    for example:
    textbox1 (field a1) = textbox2 (field a1 value)
    ...
    Thank so much

  8. #8
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    SQL is a query. If you can't make the query the source of the report, you'll need to use DLookup. You can not have SQL as the control source of a textbox.
    Paul

  9. #9
    Join Date
    Aug 2010
    Posts
    18
    I need to use SQL because:
    If product_code is A then
    run sql a
    If product_code is B then
    run sql b
    .....
    .....

    so I need to use SQL, insted of using query or dlookup.
    thanks so much.

  10. #10
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    nah
    in my opinion what you really need is to redesign your tables so you have one table for many products, not one table per product.

    however its perfectly possible to open a report or form specifying a parameter, and use that parameter for, say the rowsource. place some code in the reports on open event which selects or specifies the row source
    I'd rather be riding on the Tiger 800 or the Norton

  11. #11
    Join Date
    Aug 2010
    Posts
    18
    thank you so much, healdem
    can you help me with On Open event code for example above?
    I really thank yo

  12. #12
    Join Date
    Aug 2010
    Posts
    18
    is it true that we can store query result (all fields of a table) into a texbox on a report?

  13. #13
    Join Date
    Aug 2010
    Posts
    18
    does anyone know this? pls help me

  14. #14
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    You'd probably receive more answers is you could be more specific in your questions. What you have asked so far are very general questions about the way Access (or any other similar program) works. The help system of Access can probably provide most of the answers.

    About queries, the result of a SELECT query consists in a data set (RecordSet), i.e. a set of data organized in rows and columns. If you want to "store" this data set into a single control (TextBox) on a form or report, you have to concatenate (put together) the various elements of the resulting data set, except if the query returns a single value. Depending on precisely what you want to do, there are several possible solutions to such a problem.

    We're here to help but you need to be specific enough in what you ask if you want to receive useful answers. See:
    http://www.dbforums.com/microsoft-ac...ml#post4534485
    Have a nice day!

Posting Permissions

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