Results 1 to 4 of 4
  1. #1
    Peter3 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2017
    Posts
    12

    Result of the query displayed in text field.

    Hello,



    Can you advise me?
    Is it possible to insert in the report a text field in which the result of the query will be displayed depending on the selected option ?

    E.g.
    One text field and 5 buttons - pressing the button displays the result of the selected query execution in the window - pressing another button dynamically changes the contents of the field (another query).

    Code:
    Sub button_Click()
    -- run QUERY1, and display in the report field
    End Sub
    How do I run a query from VBA and assign its result to the report field?

    Thanx a lot in advance.
    Best Regards.

  2. #2
    Minty is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    A query will return a result set, that you can base a report on. I don't see how you could a result set for just one field.
    However if your queries return a single record which is one value, you could simply change the record source of the report, provided the result field is called the same for each query.

    Alternatively if the queries are simply producing some form of summed result you could probably use a simple DSum or DCount in the report.

  3. #3
    Peter3 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2017
    Posts
    12
    Not really like that.


    In the case of a simple query result, which has one field (sum or count), I can assign them to the text field in the report (using a variable).

    Now I need to assign a query result to the text field, which is a table (5 columns, 20 rows). I have several such queries and I would like to control the buttons and display the selected results.
    I saw such a solution, but I do not know how it was made. How to achieve it the easiest way? Is there a simple method? Could you advise something?

  4. #4
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    There seems to be some confusion over this. You have a report with a text field - where are the buttons that you are clicking on, are they on the report itself? Then you say the text field is a table - a table in Access is an object which stores data, so what are you referring to here? Please provide more details as to your process and how to get to where you want the field displayed.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 02-07-2017, 02:40 PM
  2. # Error displayed in Text Field
    By willfrank in forum Access
    Replies: 5
    Last Post: 07-05-2016, 09:19 AM
  3. Text box show result of query
    By Ash in forum Access
    Replies: 2
    Last Post: 08-06-2014, 03:00 PM
  4. Replies: 1
    Last Post: 07-12-2012, 12:09 PM
  5. Replies: 1
    Last Post: 09-28-2011, 09:48 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums