Results 1 to 10 of 10
  1. #1
    accesslessio is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Sep 2016
    Posts
    10

    form doesn't populate by query results!

    I have a form divided into tabs. One tab contains a spreadsheet view sub-form and a textbox above the subform. The subform has the record source set by the query 'tests' results. The criteria of the query reads the information wrote in the textbox. Everything is fine, but, as I run the query instead of populating me the subform it opens me an access tab with the query results (the same that opens when you run a query by double clicking the query name on the list on the left menu. How can I make the query populate the form instead of opening a tab in the access main window?

  2. #2
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    as I run the query instead of populating me the subform it opens me an access tab with the query results
    how are you running the query? and how are you apply the criteria?

  3. #3
    accesslessio is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Sep 2016
    Posts
    10
    I'm running the query by clicking a button that runs a macro. The macro has the instruction OpenQuery. The criteria is [form]![MacroAttività]![testo493]. The query works but it opens me a query tab with the result listed in a spreadsheet view (as normally done when you double click the query in the left menu)

  4. #4
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    the clue is in the name of your command - openquery. I don't use macros, so no idea what the macro way might be (assuming it is possible). I'm surprised at your criteria - how does the query know which field to apply the value to?

    If this is a web database then I guess you are stuck with macros.

    Assuming your subform has its recordsource set to the query, then instead of applying the criteria to the query, you would apply to the subform filter.

  5. #5
    accesslessio is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Sep 2016
    Posts
    10
    Quote Originally Posted by Ajax View Post
    the clue is in the name of your command - openquery. I don't use macros, so no idea what the macro way might be (assuming it is possible). I'm surprised at your criteria - how does the query know which field to apply the value to?

    If this is a web database then I guess you are stuck with macros.

    Assuming your subform has its recordsource set to the query, then instead of applying the criteria to the query, you would apply to the subform filter.
    It's not a web db. What do you mean apply the criteria to the subform filter. You mean the criteria of the query? that one is set to the textbox493 in order to receive user input. How do I set to the subform filter? Maybe I didn't understand.

  6. #6
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    Assuming your subform has its recordsource set to the query, then instead of applying the criteria to the query, you would apply to the subform filter.
    at the moment I'm assuming you have a query called say 'Query1' and in the after update event of your testo493 control you are using openquery.

    In vba this would look something like

    docmd.openquery "Query1"

    instead try

    mysubformcontrolnamehere.requery

  7. #7
    accesslessio is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Sep 2016
    Posts
    10
    I did it but it displays only an emtpy frame instead of the subform. I really don't know what going on..I'm very pissed. It's been more that 3 hours that I'm working and on a combobox that populates a table where itself takes the listed values. On the web I find poor references and old tutorials.. Only forums helps me get out..

  8. #8
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    It's been more that 3 hours that I'm working and on a combobox
    thought you were talking about a textbox

    suggest compact and zip your database and upload here. remove all forms, queries, tables etc which are not relevant.

  9. #9
    accesslessio is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Sep 2016
    Posts
    10
    Quote Originally Posted by Ajax View Post
    thought you were talking about a textbox
    That's another work I'm on

    Quote Originally Posted by Ajax View Post
    suggest compact and zip your database and upload here. remove all forms, queries, tables etc which are not relevant.
    here. The control is textbox 494 in the form MacroAttività, tab 'lista progetti/attività'
    Where do I upload the file?

  10. #10
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    click on the 'go advanced' button next to the 'post quick reply' button. You'll see the options there

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

Similar Threads

  1. Replies: 3
    Last Post: 03-21-2016, 04:28 PM
  2. Replies: 21
    Last Post: 08-29-2013, 11:08 AM
  3. Query doesn't display any results
    By premis in forum Queries
    Replies: 4
    Last Post: 12-06-2012, 04:49 PM
  4. Replies: 2
    Last Post: 12-30-2011, 07:19 PM
  5. Replies: 5
    Last Post: 10-06-2011, 05:49 PM

Tags for this Thread

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