Results 1 to 8 of 8
  1. #1
    vladimir.tz is offline Novice
    Windows XP Access 2003
    Join Date
    May 2010
    Posts
    4

    List box not reflecting change on a form

    Hi all,
    This is my first post here, I apologize for my English since it is my second language...



    Here is my problem: I have a form (based on query) which shows all the invoices for certain category of contracts. In this category, there is about 20 contracts and about 150 invoices. There is a listbox on the form and users can browse thru the invoices by finding them on that listbox.
    I also have a combobox with all the contracts so users can select certain contract to filter invoices for that contract only.
    All that is working fine, but my listbox will always show ALL the invoices regardless of combo selection. I want listbox to show invoices only for contract selected via combobox.
    I am not a access novice and will try to help others with their problems but now I need help on this one.

    Thanks in advance!!!

  2. #2
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    That would be the same concept as this:

    http://www.baldyweb.com/CascadingCombo.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    vladimir.tz is offline Novice
    Windows XP Access 2003
    Join Date
    May 2010
    Posts
    4
    Thanks for your fast response.

    where do I put this:

    strSource = "SELECT City " & _
    "FROM Cities " & _
    "WHERE State = '" & Me.cboState2 & "' ORDER BY City"
    Me.cboCities2.RowSource = strSource
    Me.cboCities2 = vbNullString

    Also, when I open my form, the listbox will show al the invoices. Then, after combobox selection, the listbox should reflect that change (and show invoices for selected contract only).

  4. #4
    vladimir.tz is offline Novice
    Windows XP Access 2003
    Join Date
    May 2010
    Posts
    4
    OK, this is my SQL for the listbox:
    SELECT [QRY - Invoice TO002 bycontractNEW].[Invoice Number]
    FROM [QRY - Invoice TO002 bycontractNEW]
    WHERE ((([QRY - Invoice TO002 bycontractNEW].[Contract Number])=[Forms]![Combo57]![Contract Number]));

    QRY - Invoice TO002 bycontractNEW is where my information is coming from.

    Combo57 is where users select the contract
    List45 is name of the listbox.

    This is code behind Combo57:

    Private Sub Combo57_AfterUpdate()
    If Not IsNull(Me.Combo57) Then
    Me.FilterOn = True
    Me.Filter = "[Contract Number] ='" & Me.Combo57 & "'"
    Else
    Me.FilterOn = False
    End If
    End Sub


    Every time I open my form, I receive Enter Parameter Value: Forms!FRM - Invoices TO0002 by contractNEW!Contract Number

  5. #5
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    If you want to show all records when the form opens, then don't use a criteria. Your form reference syntax is wrong:

    Forms Refer to Form and Subform properties and controls
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    vladimir.tz is offline Novice
    Windows XP Access 2003
    Join Date
    May 2010
    Posts
    4
    Quote Originally Posted by pbaldy View Post
    If you want to show all records when the form opens, then don't use a criteria. Your form reference syntax is wrong:

    Forms Refer to Form and Subform properties and controls

    Well, I do not want form to show all records, I am telling you what is happening to my form now. When I open form, all invoices are listed in the listbox. When I go to the combox and select contract number, the form will show invoices for that contract but the list box is still showing ALL invoices.

    I appreciate your efforts to help me out.
    Greetings from Middle East

  7. #7
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    I realize that; I said when the form opens. That link demonstrated two methods of updating the listbox. Given what I assume is the desire for the listbox to show all records when the form opens, I'd use the method that changes its row source. The code you posted in #4 is filtering the form, not the listbox.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  8. #8
    Ruby16 is offline Novice
    Windows XP Access 2010 (version 14.0)
    Join Date
    May 2010
    Posts
    1
    Quote Originally Posted by vladimir.tz View Post
    Hi all,
    This is my first post here, I apologize for my English since it is my second language...

    Here is my problem: I have a form (based on query) which shows all the invoices for certain category of contracts. In this category, there is about 20 contracts and about 150 invoices. There is a listbox on the form and users can browse thru the invoices by finding them on that listbox.
    I also have a combobox with all the contracts so users can select certain contract to filter invoices for that contract only.
    All that is working fine, but my listbox will always show ALL the invoices regardless of combo selection. I want listbox to show invoices only for contract selected via combobox.
    I am not a access novice and will try to help others with their problems but now I need help on this one.

    Thanks in advance!!!

    I found a site that would help you try it Sample forms

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

Similar Threads

  1. Change Password form
    By turbo910 in forum Forms
    Replies: 16
    Last Post: 05-07-2015, 09:02 AM
  2. Replies: 3
    Last Post: 03-25-2010, 12:31 PM
  3. Color change in form filed
    By miziri in forum Programming
    Replies: 3
    Last Post: 08-15-2009, 04:53 PM
  4. Change to Form Closes Access
    By jbhjm in forum Forms
    Replies: 5
    Last Post: 04-22-2009, 01:04 PM
  5. Change the colour of a form background
    By r_e_v_a_n_s in forum Forms
    Replies: 0
    Last Post: 11-15-2005, 03:39 AM

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
  •  
Other Forums: Microsoft Office Forums