Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2012
    Posts
    1

    Unanswered: Combo Box Filter Help

    I have a table of 100 staff, I have added a filter on the form, ie users select name (from a unbound combo box) and is able to scroll through all records for that name. If no records have been created for MrA and you select that name in the filter I get a runtime error,

    What do I need to add to my VB that will cancel the error and state –No Records held for that name then revert bank to showing all records

    Private Sub CoName_AfterUpdate()
    If IsNull(Me.CoName) Then
    Me.FilterOn = False
    Else
    Me.Filter = "StafflName = """ & Me.CoName & """"
    Me.FilterOn = True


    Me.subfrm_frm_OpenActions.Form.Filter = "[StaffName] = " & Chr(34) & Me.CoName & Chr(34)

    End If

    End Sub

  2. #2
    Join Date
    Feb 2004
    Location
    New Zealand
    Posts
    1,422
    Provided Answers: 8
    the SubForm should be link to the Main form
    by the

    Link Child Fields
    Link Master Fields

    if these are full out the Database will keep everything in Sink you would have to do the

    me.subfrm ..............
    hope this help

    See clear as mud


    StePhan McKillen
    the aim is store once, not store multiple times
    Remember... Optimize 'til you die!
    Progaming environment:
    Access based on my own environment: DAO3.6/A97/A2000/A2003/A2007/A2010
    VB based on my own environment: vb6 sp5
    ASP based on my own environment: 5.6
    VB-NET based on my own environment started 2007
    SQL-2005 based on my own environment started 2008
    MYLE
    YOUR PASSWORD IS JUST LIKE YOUR TOOTHBRUSH DON'T SHARE IT.

  3. #3
    Join Date
    May 2004
    Location
    New York State
    Posts
    1,178
    I see the following few things I'm not too sure about in your code:

    1 - What is the runtime error message?

    2 - Why don't you filter the combobox to those personnel who have records in the table?

    3 - Me.Filter = "StafflName = """ & Me.CoName & """" should read
    Code:
    Me.Filter = "StafflName = '" & Me.CoName & "'"
    4. In the above statement, the field name is "StafflName" with an 'l' between the Staff and the Name. However, in the final statement, the field name seems to be StaffName, without the 'l'.

    Sam

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •