1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

How to return data using checkboxes

Discussion in 'Software Development' started by Hemp31, Feb 17, 2014.

Thread Status:
Not open for further replies.
Advertisement
  1. Hemp31

    Hemp31 Thread Starter

    Joined:
    Feb 17, 2014
    Messages:
    7
    I have a forum called FrmAgent that i created in access 2007. It id pulling information from a table called "Agent". in my forum i have 5 checkboxes with names next to them. The names are also found in the table in a column called Agent Name. What i want is if the check box is checked next to that persons name it crabs the data and runs the query when a button is clicked. Example if one or more boxes are clicked it would run the data. Does this make sense? If anyone could help me that would be great. I am very new to vba and access so any help would be great. examples too. Thank you again
     
  2. draceplace

    draceplace

    Joined:
    Jun 8, 2001
    Messages:
    2,583
    How important is it to pull all agents more than one at time? Is 5 agents a static number or does this change and agents fluxuate?
     
  3. Hemp31

    Hemp31 Thread Starter

    Joined:
    Feb 17, 2014
    Messages:
    7
    It is always going to be the same five agents.
     
  4. draceplace

    draceplace

    Joined:
    Jun 8, 2001
    Messages:
    2,583
    If we can limit the search to one agent at time we can do this relatively easy.
    Lets get this working then we'll do the query.

    On an unbound form:
    1st step is to make an option group(name the frame Fra_AgtSearch) -The label doesn't matter.
    2. Add the 5 option buttons. Label captions are the text to use in the search.-Name the labels Label_Agent01, Label_Agent02...
    3. Add an unbound text box name= Agent_txt (we will make this not visable later)

    4. Add this vba to the 'After Update' Event - event proceedure on the Option Group(Fra_AgtSearch)
    _______________________________________
    Private Sub Fra_AgtSearch_AfterUpdate()
    On Error GoTo GenericError

    Select Case Fra_AgtSearch.Value
    Case 1
    Me.Agent_txt = Me.Label_Agent01.Caption
    Case 2
    Me.Agent_txt = Me.Label_Agent02.Caption
    End Select

    NoError:
    Exit Sub
    GenericError:
    MsgBox "Error Number: " & Err.Number & vbCrLf & Err.Description
    Resume NoError
    End Sub
     
  5. draceplace

    draceplace

    Joined:
    Jun 8, 2001
    Messages:
    2,583
    Note: you need to copy and replicate Case statements for ( Agent_txt= Me.Label_Agent02.Caption) agents 3,4,5 before the End Select. But we can get it work for 2 to get rolling.
     
  6. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1120170

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice