Page 2 of 2 FirstFirst 12
Results 16 to 28 of 28
  1. #16
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922

    There is a lot to be said for "it works as I want". Thanks.

  2. #17
    Mclaren is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2010
    Location
    Johannesburg
    Posts
    164
    should i elaborate more ? Not really sure what you mean ?

  3. #18
    goodguy is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Dec 2010
    Location
    Zanzibar, Tanzania
    Posts
    229
    To cut a long story short, I set this code on your combo's NotInList event to filter the combo row source directly without the need for opening a search form etc:
    Code:
    Private Sub cbo_UPNCode_NotInList(NewData As String, Response As Integer)
        Dim str As String
        str = NewData
        cbo_UPNCode.Undo
        cbo_UPNCode.RowSource = "SELECT ProductID, UPN FROM tbl_Product WHERE UPN LIKE ""*" & NewData & "*"" ORDER BY tbl_Product.UPN"
        cbo_UPNCode.Requery
    End Sub
    I also set the combo After Update event to remove the filter:
    Code:
    Private Sub cbo_UPNCode_AfterUpdate()
        cbo_UPNCode.RowSource = "SELECT tbl_Product.ProductID, tbl_Product.UPN FROM tbl_Product ORDER BY tbl_Product.UPN "
        cbo_UPNCode.Requery
    End Sub
    I tested it and the subform filters the combo and saves the records OK.
    Hope this solves your problem?

  4. #19
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Just an FYI, I'm pretty sure any time you change a RowSource or RecordSource Access will do the Requery for you.

  5. #20
    goodguy is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Dec 2010
    Location
    Zanzibar, Tanzania
    Posts
    229
    Actually, I thought so too, but when I found blanks in my dropdown, so I added it.

  6. #21
    Mclaren is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2010
    Location
    Johannesburg
    Posts
    164
    Hmmmm, will try this over the weekend, this might make things a lot simpler.

  7. #22
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Quote Originally Posted by goodguy View Post
    Actually, I thought so too, but when I found blanks in my dropdown, so I added it.
    Interesting. Thank you for the information. I stand corrected.

  8. #23
    goodguy is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Dec 2010
    Location
    Zanzibar, Tanzania
    Posts
    229
    You are both welcome. We learn more when we help/teach.

  9. #24
    Mclaren is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2010
    Location
    Johannesburg
    Posts
    164
    Works a treat. added "cbo_UPNCode.Dropdown" to the not in list event. thus ensuring the user sees that there is a problem or options to choose from.

    Now just need to supress the default warning message of the not in list trigger.

  10. #25
    goodguy is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Dec 2010
    Location
    Zanzibar, Tanzania
    Posts
    229
    Let me know when you are done!

  11. #26
    goodguy is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Dec 2010
    Location
    Zanzibar, Tanzania
    Posts
    229
    In case you are still searching:
    Code:
    Dim str As String
        DoCmd.SetWarnings False
        str = NewData
        cbo_UPNCode.Undo
        cbo_UPNCode.RowSource = "SELECT ProductID, UPN FROM tbl_Product WHERE UPN LIKE ""*" & NewData & "*"" ORDER BY tbl_Product.UPN"
        Response = acDataErrContinue
        'cbo_UPNCode.Requery
        cbo_UPNCode.Dropdown
        DoCmd.SetWarnings True
    works perfectly.

  12. #27
    Mclaren is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2010
    Location
    Johannesburg
    Posts
    164
    Not Searching, Already done, just didn't get around to posting yet.

    Thanks all for the help.

  13. #28
    goodguy is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Dec 2010
    Location
    Zanzibar, Tanzania
    Posts
    229
    You are welcome, buddy.

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 06-16-2011, 09:30 PM
  2. Replies: 1
    Last Post: 10-22-2010, 10:11 AM
  3. Input data from one list box to another list box
    By KellyR in forum Programming
    Replies: 0
    Last Post: 06-04-2010, 11:24 AM
  4. Replies: 3
    Last Post: 03-25-2010, 12:31 PM
  5. List box to populate other list boxes
    By Nathan in forum Forms
    Replies: 0
    Last Post: 03-03-2009, 07:22 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