Results 1 to 4 of 4
  1. #1
    loneman is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2010
    Posts
    3

    How to place query results on the same form - ACCESS 2007

    Hi, I have created a form and the header I have a text box with a command button. When user enters text (supplier name) the command button should run a query taking as the supplier name as the parameter and show data belongs to the supplier in a data view. I got this working but when I click the command button Access 2007 opens up a the query in a different tab. How can I add the resulting data view to the same form in the detail section of the form.

    Any help would be appreciated.

  2. #2
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    create a subform based off of the SELECT query you have stored. Have your command button, in VBA, do Me.subformName.Requery

    that should take care of it.

  3. #3
    loneman is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2010
    Posts
    3
    Hi Court, thank you for the reply.

    I added the VBA code but I won’t see the data in the sub Form.

    Here is what I have in the main form (name) FSupplier

    In the header section:
    textbox: txtSupplier
    commandButton: cmdSearch

    In the Details Section:
    I have the Sub form: SubForm this is based on the query QSupplier

    I have a query call QSupplier with the criteria as [Forms]![FSupplier].[txtSupplier]

    I added the commandButton eventProcedure in VBA..as follows.

    Private Sub cmdSearch_Click()
    Me.SubForm.Requery
    End Sub

    What am I doing wrong here?

  4. #4
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    They criteria in the query should be
    [Forms]![FSupplier]![txtSupplier]

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

Similar Threads

  1. Replies: 6
    Last Post: 05-14-2012, 07:24 AM
  2. score and place query
    By ymds in forum Queries
    Replies: 1
    Last Post: 06-10-2010, 06:07 PM
  3. Replies: 1
    Last Post: 05-21-2009, 08:13 AM
  4. Replies: 0
    Last Post: 02-21-2008, 09:52 AM
  5. Entering query results in a form
    By marcello.dolcini in forum Forms
    Replies: 0
    Last Post: 04-15-2007, 06:01 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