Results 1 to 4 of 4
  1. #1
    BorisGomel is offline Competent Performer
    Windows Vista Access 2003
    Join Date
    Apr 2011
    Posts
    101

    Sub form filtered by listbox

    Hello,



    I have a sub form that is called QBCHECKS2011 and form which is called InqireByClients .On form there is a list box (lstClients) that filters the sub form via mother child relationship . “ClienstName” is the same filed that list box and sub form have . It works ok , but there is one problem is that the list box always filters the form by one filed which is “ClientName”. I would like to have sub form not to be filtered until Clients filed is selected in the list box. In another world I would like to open the sub form not filtered and only to be filtered when the Clients is being selected in the list box.
    Thank for your advice with this matter.

    Best Reagrds

  2. #2
    Join Date
    Apr 2011
    Posts
    18
    You would need to add code to the AfterUpdate Event of the listbox (and if listbox is bound, also to the Current Event of the form)

    Code:
    If Me.ClientName.ItemData.Count<>0 Then
     Me.QBCHECKS2011.Form.FilterOn=False
    Else
     Me.QBCHECKS2011.Form.Filter="You fill in your own filter string here, based on whatever your conditions are"
     Me.QBCHECKS2011.Form.FilterOn=True
    End If

  3. #3
    Join Date
    Apr 2011
    Posts
    18
    Sorry, I have no idea what is wrong with the posting engine on this site, as im quite new here. Try to ignore all the stuff about Size and Font that the site has added.....

  4. #4
    BorisGomel is offline Competent Performer
    Windows Vista Access 2003
    Join Date
    Apr 2011
    Posts
    101
    Hi TheSmileyCoder.

    Thank you very mcuh for youe time of helping me .

    I typed the code that you have so graciously provided and it doesn’t work.

    The VB debugs mistake in the first line of code:”Method or Data not found”
    IfMe.ClientName.ItemData.Count

    There is not ClientName in drop menu of VB in the code window .There only Listbox lstClients .I put it in there but the “count” after “Item Data” not showing up in the code drop menu .
    Really appreciated if you be so kind of to review the code .

    Thank so much for your help.

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

Similar Threads

  1. Replies: 2
    Last Post: 01-15-2011, 10:56 AM
  2. Form ListBox Know-how
    By InThrees in forum Forms
    Replies: 5
    Last Post: 12-03-2010, 01:02 PM
  3. update query fon a filtered form HELP!
    By campanellisj in forum Queries
    Replies: 0
    Last Post: 11-12-2010, 09:08 AM
  4. Open form to filtered records
    By ducecoop in forum Access
    Replies: 3
    Last Post: 10-22-2010, 10:53 AM
  5. making a table from a filtered split form
    By stephenaa5 in forum Queries
    Replies: 2
    Last Post: 08-25-2010, 08:56 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