Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Natan is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    16

    How to display Contact per each Company I select?

    Hi there.

    My question is-
    I have Companies Table & Contacts Table

    In Contacts Table, there is Company field which is linked to Companies Table.

    I want to make a form in which I can choose the company name and then choose a person name. But I need the Contact list to filter by the Company name I selected before.

    Hope you understood me.
    I'm new in Access and in here as-well.

    Thanks ahead! Seems to be great forum from what I saw...
    Last edited by Natan; 06-28-2011 at 10:56 AM. Reason: text mistake

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Welcome to the site. Sounds like you want cascading combos:

    Baldy-Cascading Combos
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Natan is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    16
    I did this thing:

    Private Sub cboCategory_AfterUpdate()
    ' Update the row source of the cboStatus combo box
    ' when the user makes a selection in the cboCategory
    ' combo box.
    Me.cboStatus.RowSource = "SELECT tblStatuses.StatusID FROM" & _
    " qryStatusesCategories WHERE tblCategories.CategoryName = " & _
    Me.cboCategory & _
    " ORDER BY tblStatuses.StatusID"

    Me.cboStatus = Me.cboStatus.ItemData(0)
    End Sub
    It does no show any option...

    BTW, I make multiple values on StatusID.
    And there are multiple Categories for each status.
    So I've made a query to show each status per category.
    Hope you understood.

    Thanks ahead.
    Last edited by Natan; 06-29-2011 at 12:59 PM.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Looks okay, assuming CategoryName is a numeric field, which it doesn't sound like. Can you post the db?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    Natan is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    16
    Quote Originally Posted by pbaldy View Post
    Looks okay, assuming CategoryName is a numeric field, which it doesn't sound like. Can you post the db?
    No, CategoryName is a text value.
    I'll post the db as soon as I get home.

    Is that the problem? that it's not a numeric value?

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Try

    Me.cboStatus.RowSource = "SELECT tblStatuses.StatusID FROM" & _
    " qryStatusesCategories WHERE tblCategories.CategoryName = '" & _
    Me.cboCategory & _
    "' ORDER BY tblStatuses.StatusID"

    Note the single quotes surrounding the value.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    Natan is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    16
    Hi,

    I tried it and still - nothing shows up.

    I've uploaded my DB to a server, because it's larger than 500kb, here's the link:

    www.martech.co.il/STDB2012.rar

    Please ignore text in other language.

    Look in "tblCategories", "tblStatuses", "qryStatusesCategories" & "frmWorks".

    Thanks Ahead!!!
    Last edited by Natan; 06-30-2011 at 11:14 AM. Reason: fixed link

  8. #8
    Natan is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    16
    Bump. please...

    I can not progress

  9. #9
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I was hoping someone would jump in. I don't like downloading from unknown sites, and I don't feel like downloading software to handle the rar format. If you can zip a sample and upload it here, I'll take a look.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  10. #10
    Natan is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    16
    Here, ZIP format.

    Thanks ahead dude.

  11. #11
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    You have the wrong field in the criteria, so you're comparing apples to oranges. Try

    Code:
      Me.cboStatusName.RowSource = "SELECT StatusID, StatusName, CategoryName FROM" & _
                                 " qryStatusesCategories WHERE StatusID = " & _
                                   Me.cboCategoryName & _
                                 " ORDER BY tblStatuses.StatusID"
    That leaves you with a display issue that I think you can work out.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  12. #12
    Natan is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    16
    Thanks man, you helped a lot!

    by-the-way,

    1. You got a bit wrong in your code:

    " qryStatusesCategories WHERE StatusID = " & _
    to
    " qryStatusesCategories WHERE CategoryID = " & _

    2. I allowed multiple values and it show an error. (Run-time error, cannot perform this operation)
    Then I go to debugger and it marks this row:


    Me.cboStatusName.RowSource = "SELECT StatusID, StatusName, CategoryName FROM" & _
    " qryStatusesCategories WHERE CategoryID = " & _
    Me.cboCategoryName & _
    " ORDER BY tblStatuses.StatusID"

    Me.cboStatusName = Me.cboStatusName.ItemData(0)

    So I removed it, tried to filter again and it worked, but when I select multiple values it shows an error, look at the picture I added.

    Thanks ahead again!!!

  13. #13
    Natan is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    16
    Bump please.

  14. #14
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Not sure; I don't like or use the new multi-value field.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  15. #15
    Natan is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    16
    Quote Originally Posted by pbaldy View Post
    Not sure; I don't like or use the new multi-value field.
    Is there a way to make it, lets say like comment thing so I'll know in what date each status was updated? If yes, how do I do that?

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

Similar Threads

  1. Database for Company's Output
    By cg98721 in forum Database Design
    Replies: 1
    Last Post: 06-15-2011, 07:10 AM
  2. YTD MTD WTD Report On Company Calendar
    By jortizz in forum Reports
    Replies: 3
    Last Post: 05-07-2011, 12:01 AM
  3. Contact Histroy Queries
    By desmondok in forum Queries
    Replies: 1
    Last Post: 08-02-2010, 05:30 PM
  4. International Shipping Company Database Design
    By chaienbungbu in forum Database Design
    Replies: 1
    Last Post: 02-13-2010, 01:31 PM
  5. last contact
    By mitchy1111 in forum Queries
    Replies: 3
    Last Post: 10-10-2009, 04:53 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