Form Searching

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dougmeece
    New Member
    • Feb 2008
    • 48

    Form Searching

    I am trying to create a search from a form but am having trouble getting data returned.

    - I have a combo box, CboTitle Search that I select the criteria from.
    - I have a search button, cmdSearch, that is looking through a query of submitted work when clicked.
    - I want to compare what is selected in the combo box to the rows in the query and pull all the data in the query for the titles that match.
    - I have tried creating a separate query for this process and using the OnClick Event Procedure to run it but I am not getting any results.
    [SQL Query CODE]
    [CODE=SQL]SELECT Created_Submitt ed_Query.Title, Created_Submitt ed_Query.[Year Created], Created_Submitt ed_Query.Submit ted, Created_Submitt ed_Query.[Submitted To], Created_Submitt ed_Query.Websit e, Created_Submitt ed_Query.Accept ed, Created_Submitt ed_Query.Date, Created_Submitt ed_Query.Type
    FROM Created_Submitt ed_Query
    WHERE ((([Forms]![Records_Search]![CboTitleSearch])=[Created_Submitt ed_Query].[Title]))
    GROUP BY Created_Submitt ed_Query.Title, Created_Submitt ed_Query.[Year Created], Created_Submitt ed_Query.Submit ted, Created_Submitt ed_Query.[Submitted To], Created_Submitt ed_Query.Websit e, Created_Submitt ed_Query.Accept ed, Created_Submitt ed_Query.Date, Created_Submitt ed_Query.Type;[/CODE]
    [SQL Query CODE]

    Ultimately I would like to have the results appear as a sub-form on the bottom half of my search form instead of opening another screen. However, I can fight that battle later if necessary.

    Unfortunately for me I am not a programmer and am just trying to teach myself how to do some things. Any help on this would be greatly appreciated.

    Thanks,
    Doug
  • dougmeece
    New Member
    • Feb 2008
    • 48

    #2
    Dangit

    Hello,

    I actually had the query, Records Search Query, retunring data now but only when I ran it direclty and not by using the command button. Here is the code for the command button.

    [Command Button Code]
    Code:
    Private Sub CmdSearch_Click()
    On Error GoTo Err_CmdSearch_Click
    
        Dim stDocName As String
    
        stDocName = "Records Search Query"
        DoCmd.OpenQuery stDocName, acNormal, acEdit
            
        
    Exit_CmdSearch_Click:
        Exit Sub
    
    Err_CmdSearch_Click:
        MsgBox Err.Description
        Resume Exit_CmdSearch_Click
        
    End Sub
    [Command Button Code]

    Do I need an IF statement of soemthing in the code above? After testing it in the form again I started receiving no returns regardless of how I tried it. If I close Access and come back in I am again able to receive data back after getting prompted with a dialog box to enter a title.
    Last edited by dougmeece; Apr 18 '08, 02:14 PM. Reason: Symptoms Changed

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32656

      #3
      Doug, Your question seems a little complex. Check out Example Filtering on a Form and let us know if you're still having problems. Then, if we need to, we can go into more detail.

      PS. Note the use of the [ CODE ] tags. They're required to show the code properly.

      Comment

      Working...