UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Filter Form By Yes/no/all, Access 2010    
 
   
Delta729
post Dec 22 2017, 08:06 PM
Post#1



Posts: 138
Joined: 11-January 15



To RJD and everyone that has guided me so far, thank you very much.

I basically started from scratch early today with my databases after re-reviewing some of the recent comments, and rethought about the whole thing... (again).

I have this form and there is a checkbox for "Inactive" purchase orders. You know, simply click the box if the PO is Inactive. I made an unbound checkbox called chkPO and linked it, but this is not really what I'm wanting, after think about it. What I really need it to show if the PO is Active, Inactive, and both.

I was playing with a control group earlier, but I'm completely lost with them. Would this be the best way to go? If so, could anyone send a link for some learning for this newbie. Or, with a yes/no/both, should I just create something with VBA? Any suggestions?

The form filters what I have for either

CODE
Private Sub chkPO_Click()
    If Me.chkPO.Value Then
        Me.Filter = "Inactive = " & Me.chkPO = True
        Me.FilterOn = True
        Me.Requery
    Else
        
        Me.FilterOn = False
        Me.Requery
    End If
End Sub

--------------------
[font="Georgia"][/font]Daniel
Go to the top of the page
 
LeicsChris
post Dec 22 2017, 08:37 PM
Post#2



Posts: 120
Joined: 23-May 17



Hi
I asked a similar question a while back and the solution I came up with was quite simple.

I put an option box on the form with 'all / active / cancelled ' radio buttons and then a command button next to with the title Update.

I ram a macro when the button was pressed and the macro comprised of a condition for each of the three options which applied a querie for each in the "where' part.

Option = 1 is all records
Option =;2 is POCURRENT = true
Option = 3 is POCURRENT = FALSE

Works a treat

Chris
Go to the top of the page
 
DanielPineault
post Dec 22 2017, 08:39 PM
Post#3


UtterAccess VIP
Posts: 5,962
Joined: 30-June 11



I'd use an Option group with you three options and then use a case statement to act accordingly.

Let's Assume

Active = 1
Inactive = 2
Both/All records = 3


Then you'd do something along the lines of
CODE
    Select Case Me.OptionGroupName
        Case 1 'Active
            Me.Filter = "Inactive = True"
            Me.FilterOn = True
        Case 2 'Inactive
            Me.Filter = "Inactive = False"
            Me.FilterOn = True
        Case 3 'Both/All records
            Me.FilterOn = False
    End Select

--------------------
Daniel Pineault (2010-2017 Microsoft MVP)
Professional Help: http://www.cardaconsultants.com
Free MS Access Code, Tips, Tricks and Samples: http://www.devhut.net

* Design should never say "Look at me". It should always say "Look at this". -- David Craib
* A user interface is like a joke, if you have to explain it, it's not that good! -- Martin LeBlanc


All code samples, demonstration databases, links,... are provided 'AS IS' and are to be used at your own risk! Take the necessary steps to check, validate ...(you are responsible for your choices and actions)
Go to the top of the page
 
RJD
post Dec 22 2017, 08:53 PM
Post#4


UtterAccess VIP
Posts: 8,481
Joined: 25-October 10
From: Gulf South USA


Hi again: ...or you could use a combobox with "Active", "Inactive" and "Both" selections. Then accommodate this in the source query. See the revision to your previous db. See the form, then the record source. This way the "look" will be consistent with your other selections.

Also note that the SQL is still in the Record Source and should be moved to a saved query, and referenced in the form Record Source.

HTH
Joe
Attached File(s)
Attached File  Invoice_Database_97_Rev2.zip ( 68.65K )Number of downloads: 13
 

--------------------
"Each problem that I solved became a rule, which served afterwards to solve other problems."
"You just keep pushing. You just keep pushing. I made every mistake that could be made. But I just kept pushing."

Rene Descartes 1596-1650 (Mathematician and Philosopher)
Go to the top of the page
 
Delta729
post Dec 22 2017, 09:15 PM
Post#5



Posts: 138
Joined: 11-January 15



Hi Daniel, this was dang near perfect. Sorry, I'm learning on the run here, I had just figure out how to insert the frame and then the buttons, when I saw your code. It just me a couple minutes to figure out to add it to the click event for the frame (and actually change the code to match my frames name, duh!) and then reverse option 1 and two around, and it works perfectly. Now I think I can figure it out in the future...

Hi RJD, I basically started over this morning, almost from scratch. I saw the comments regarding the last post related to not using the combobox where I had them (sections from prior forms that the data was already filled in), and I thought it would be best for me to incorporate your prior recommendations and what I was really looking to do. I know I just restarted over before last weekend, but somewhere along the line, I forgot half of yours and other recommendations. At least I'm learning a thing or two.

To All, Thank you continued kind assistance.

--------------------
[font="Georgia"][/font]Daniel
Go to the top of the page
 
DanielPineault
post Dec 23 2017, 06:25 AM
Post#6


UtterAccess VIP
Posts: 5,962
Joined: 30-June 11



thumbup.gif

--------------------
Daniel Pineault (2010-2017 Microsoft MVP)
Professional Help: http://www.cardaconsultants.com
Free MS Access Code, Tips, Tricks and Samples: http://www.devhut.net

* Design should never say "Look at me". It should always say "Look at this". -- David Craib
* A user interface is like a joke, if you have to explain it, it's not that good! -- Martin LeBlanc


All code samples, demonstration databases, links,... are provided 'AS IS' and are to be used at your own risk! Take the necessary steps to check, validate ...(you are responsible for your choices and actions)
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    19th July 2018 - 05:00 AM