[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Toggle Buttons!!!

Posted on 2001-09-12
6
Medium Priority
?
619 Views
Last Modified: 2010-05-18
I have a form with two toggle buttons...

on this form, there are certain records that have checks beside them.  I would like to be able to use the toggle buttons as preset filters but I can't seem to get it to work properly...  anyone familiar with coding toggle buttons to filter specific data?
0
Comment
Question by:scorp8
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 58
ID: 6477258
Sure. Can you outline what your trying to do or send a sample?

Jim.
0
 
LVL 1

Author Comment

by:scorp8
ID: 6477297
Example:  I have a form with 1000 records and two toggle buttons.  

Of the 1000 records, about 750 records do not need to be seen if the user elects not to see them.  In other words, one toggle button will filter out 375 and the other will filter out the other 375.  But if the user want's to see all 1000 records, he can deselect the buttons..  (Just like the normal filter by selection process in Access)

HTH

scorp8

0
 
LVL 58
ID: 6477332
There are a multitude of ways to do this. I'll give you one.  Let's say you want to sort a phone book, and provide 26 buttons, one for each letter and one additonal for "ALL".  By placing these in a group, only one can be choose at a time.

  In the groups AfterUpdate event, checking the group controls value would tell you which is pushed.  Based on that, you would set the forms filter property.  Something like:

Me.Filter = "Like 'A'"
Me.FilterOn = True
 
  a slightly better way to do that is:

strFilterLetter = Mid(Me![grpAlpha],"abcdefghijk...z*")

Me.Filter = "Like '" & strFilterLetter & "'"
Me.FilterOn = True

This is just one example.  You could also reset the forms underlying recordset and build an SQL statement on the fly.  Here's an example of changing a sort order based on toggle buttons as column headers:

    ResetRecordSource = True

    strRecordSource = "SELECT DISTINCTROW * FROM qryfrmLoadSummarySF"
    If IsNull(Me![SQLWhereClause]) Then Me![SQLWhereClause] = ""
    If (Me![btnRemoveFilter].Enabled) And Len(Me![SQLWhereClause]) > 0 Then strRecordSource = strRecordSource & " WHERE " & Me![SQLWhereClause]
    strFields = "LoadID        SchDateTime   Status        Dispatcher    OrigName      DestName      Description   BillTo        Orig          Dest          OrigRef       DestRef       "
    strRecordSource = strRecordSource & " ORDER BY " & Mid$(strFields, 14 * Me![grpSortBtns] - 13, 14)
    If Me![grpSortBtns] = 2 Then strRecordSource = strRecordSource
    strRecordSource = strRecordSource & ";"
    On Error GoTo Invalid_filter
    Me![embfrmLoadSummarySubForm].Form.RecordSource = strRecordSource
    On Error GoTo 0


That help?

Jim.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 58
ID: 6477343
Oops! two corrections:

1. I meant "filter" instead of sort in the first example.
2. I forgot to include a field in the filter clause (it's a WHERE statement without the word WHERE):

Me.Filter = "CustomerName Like 'A*'"
Me.FilterOn = True


Jim.
0
 
LVL 1

Author Comment

by:scorp8
ID: 6477375
this is what i had in mind and what I had before i asked EE.  

Currently in my form, in addition to the columns I have now, I have added two new columns set as yes/no data types.

on my upload of the 1000 records, the 375 records I'm setting up for the filter have been set to true, as well as the other 375 in the other yes/no column.  In simple terms, I have one column with 375 of 1000 records set to true, and the 2nd column doing the same.

how could I set my toggle button to take out the rows set to true in my form when I "key down", then place them back when I "key up"?

scorp8  

0
 
LVL 58

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 80 total points
ID: 6477396
Add the following Subroutine to the form:

Private Sub SetFilter()

 If Me![tgl1] = False and Me![tgl2] = False then
   Me.FilterOn = False
 ElseIf Me![tgl1] = True and Me![tgl2] = True then
   Me.Filter = "<Column1> = True AND <column2> = True"
   Me.FilterOn = True
 ElseIf Me![tgl1] = True then
   Me.Filter = "<Column1> = True"
   Me.FilterOn = True
 Else
   Me.Filter = <column2> = True"
   Me.FilterOn = True
 End If

 I believe is what your asking for.

Jim.
 
 

0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question