Results 1 to 6 of 6
  1. #1
    kingofthekassel's Avatar
    kingofthekassel is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jul 2015
    Posts
    25

    Single Control Button for multiple Combo Boxes


    Hey guys,

    To make things pretty simple, I have about four combo boxes all with different options. These give different ways to sort a bigger dataset. Anyway, I need to open a specific form which is easy enough. However I would like just one button to open the form given information in any of the combo boxes. I attached a picture of the current state of my database right now. Each button will give me the form corresponding to the ComboBox above it. Is there anyway to combine all of these buttons?
    Attached Thumbnails Attached Thumbnails Capture.JPG  

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,626
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,848
    June7 has given you a very good reference. If you want to see a free video on filtering data on a form, see this one from DataPig.

  4. #4
    kingofthekassel's Avatar
    kingofthekassel is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jul 2015
    Posts
    25
    Thank you both so much! It is working great now! So I also created a form (shown below) which is what I need my Search form to spit out. I got the search and everything working, I was just wondering if there is a way to open all of the forms that the Search filtered? I know how to create an open form button but I can't seem to get it to spit out all of the search results. It only brings up wither one of the search results or it brings up every record I have. Thank you for your help!
    Attached Thumbnails Attached Thumbnails Capture.JPG  

  5. #5
    kingofthekassel's Avatar
    kingofthekassel is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jul 2015
    Posts
    25
    Here is my code for what I have so far on my Search form, a picture of that is attached as well.

    Option Compare Database
    Option Explicit
    Private Sub cmdFilter_Click()
    Dim strWhere As String
    Dim lngLen As Long
    Const conJetDate = "\#mm\/dd\/yyyy\#"

    If Not IsNull(Me.Combo13) Then
    strWhere = strWhere & "([RiskNo] = """ & Me.Combo13 & """) AND "
    End If

    If Not IsNull(Me.Combo17) Then
    strWhere = strWhere & "([Subcategory] = """ & Me.Combo17 & """) AND "
    End If

    If Not IsNull(Me.Combo19) Then
    strWhere = strWhere & "([IPT] = """ & Me.Combo19 & """) AND "
    End If

    If Not IsNull(Me.Combo23) Then
    strWhere = strWhere & "([Level] = """ & Me.Combo23 & """) AND "
    End If

    lngLen = Len(strWhere) - 5
    If lngLen <= 0 Then
    MsgBox "No Criteria", vbInformation, "Nothing To Do."
    Else
    strWhere = Left$(strWhere, lngLen)

    Me.Filter = strWhere
    Me.FilterOn = True
    End If
    End Sub

    Private Sub cmdReset_Click()
    Dim ctl As Control
    For Each ctl In Me.Section(acHeader).Controls
    Select Case ctl.ControlType
    Case acComboBox
    ctl.Value = Null
    End Select
    Next
    Me.Filter = False
    Me.FilterOn = True
    End Sub


    Private Sub Form_Open(Cancel As Integer)
    Me.Filter = False
    Me.FilterOn = True
    End Sub


    Private Sub cmdOpen_Form_Click()
    On Error GoTo Err_cmdOpen_Form_Click
    Dim stDocName As String
    Dim stLinkCriteria As String
    stDocName = "RisksForm"

    stLinkCriteria = "[RiskNo]=" & "'" & Me![RiskNo] & "'"
    DoCmd.OpenForm stDocName, , , stLinkCriteria
    Exit_cmdOpen_Form_Click:
    Exit Sub
    Err_cmdOpen_Form_Click:
    MsgBox Err.Description
    Resume Exit_cmdOpen_Form_Click

    End Sub
    Attached Thumbnails Attached Thumbnails Capture.JPG  

  6. #6
    kingofthekassel's Avatar
    kingofthekassel is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jul 2015
    Posts
    25
    Figured it out. For those still curious, I simply used the same code for the Open form button and added the code that is unique to an open form button.

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

Similar Threads

  1. Replies: 2
    Last Post: 12-11-2014, 02:29 PM
  2. Replies: 2
    Last Post: 11-05-2014, 12:45 PM
  3. Replies: 3
    Last Post: 11-19-2013, 11:30 AM
  4. calling multiple reports from single form button
    By lugnutmonkey in forum Reports
    Replies: 3
    Last Post: 01-02-2013, 02:28 PM
  5. Form Control Button / Combo Box
    By canuck in forum Forms
    Replies: 1
    Last Post: 03-18-2011, 10:17 AM

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