Results 1 to 9 of 9
  1. #1
    Delta729 is offline Advanced Beginner
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Nov 2010
    Location
    Los Angeles
    Posts
    95

    I'm trying to filter by option group

    I'm just trying to learn a little bit of information after suffering a stroke that left me pretty much disabled. I started working on the a few years ago while at a job I had already moved to, and as of a few day ago, I've picked up my attempts again. So, please be nice, lol.



    In the attached database I'm working on in the form [RegionPOFrm], I had it working when I had not included the option group, and had just put a "false" like the following:

    SELECT PurchaseOrderTbl.PuhaseOrderID, PurchaseOrderTbl.PurchaseOrder, PurchaseOrderTbl.Inactive, PurchaseOrderTbl.StartDate, PurchaseOrderTbl.EndDate, PurchaseOrderTbl.Region, PurchaseOrderTbl.Vendor
    FROM PurchaseOrderTbl
    WHERE (((PurchaseOrderTbl.Inactive)=False));

    However, I realized that I could give the user the selection option if I put in a option group, by selecting "Active", "Inactive", or both. I've turned myself completely around and got more confused than I a normally. Could someone let me know how to fix this? I hope that made sense.
    Attached Files Attached Files

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,411
    Just use a check box which will use true or false. Option groups use 1, 2, 3 etc so you can use that with something like

    Where inactive = forms!myform!myoptiongroup - 2 or forms!myform!myptiongroup=3

    Assumes you have assigned 1 to active and 2 to inactive and 3 to both

  3. #3
    Delta729 is offline Advanced Beginner
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Nov 2010
    Location
    Los Angeles
    Posts
    95
    Something like:

    SELECT PurchaseOrderTbl.PuhaseOrderID, PurchaseOrderTbl.PurchaseOrder, PurchaseOrderTbl.Inactive, PurchaseOrderTbl.StartDate, PurchaseOrderTbl.EndDate, PurchaseOrderTbl.Region, PurchaseOrderTbl.Vendor
    FROM PurchaseOrderTbl
    WHERE (((PurchaseOrderTbl.Inactive)=[forms]![RegionPOFrm]![Frame1]));

    That doesn't do anything, so I'm sure I'm messing this up.

  4. #4
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,537
    Perhaps something like this:
    Attached Files Attached Files
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  5. #5
    Delta729 is offline Advanced Beginner
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Nov 2010
    Location
    Los Angeles
    Posts
    95
    Perfect! Thank you so much. I see how the changes work and what I was wrong.
    Thanks again.

  6. #6
    ssanfu is offline Master of Nothing
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Here is (IMHO) better code for moving Previous/Next:
    Code:
    Private Sub cmdPrior_Click()
        On Error GoTo HandleIt
    
        DoCmd.GoToRecord , , acPrevious
    
    cmdPrior_Click:
        Exit Sub
    
    HandleIt:
        If Err.Number = 2105 Then
            MsgBox "You are at the first Region - for Entering Puchase Orders!"
            DoCmd.GoToRecord , , acFirst
        End If
        Resume cmdPrior_Click
    End Sub
    
    Private Sub cmdNext_Click()
        On Error GoTo HandleIt
        
        DoCmd.GoToRecord , , acNext
        
    cmdNext_Click:
        Exit Sub
    
    HandleIt:
        If Err.Number = 2105 Then
            MsgBox "You are at the last Region - for Entering Puchase Orders!"
            DoCmd.GoToRecord , , acLast
        End If
        Resume cmdNext_Click
    End Sub


    Also, I think most developers steer away from using Navigation Forms because they are very limiting. It is much easier to just use normal forms and create your own "Navigation" system.

  7. #7
    Delta729 is offline Advanced Beginner
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Nov 2010
    Location
    Los Angeles
    Posts
    95
    I definitely agree with that info about the Navigation forms, I'm a complete novice and I figured that out. LOL

    I'm just getting my Navigation form to work, so I'll come back to try this again with creating my own Navigation system. I have no idea how to do that, but sounds like fun. I didn't even think about he code for the next and prior buttons. I see that you are referring to error code 2105. I'll have to look that up to see what that's for.

    Thanks,
    Daniel

  8. #8
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,789
    I see that you are referring to error code 2105. I'll have to look that up to see what that's for.
    I LIKE that attitude/approach!!
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  9. #9
    ssanfu is offline Master of Nothing
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    I am in total agreement...

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

Similar Threads

  1. Option Group & Combo box Filter
    By nightfire22255 in forum Programming
    Replies: 1
    Last Post: 01-25-2021, 03:21 PM
  2. Replies: 3
    Last Post: 09-27-2018, 11:54 AM
  3. Replies: 2
    Last Post: 02-19-2013, 07:47 AM
  4. Use Option Group to Filter Combo Box Values
    By dgj32784 in forum Programming
    Replies: 2
    Last Post: 06-06-2011, 12:04 PM
  5. Replies: 1
    Last Post: 11-23-2010, 01:30 PM

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