Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

MS Access Duplicates

  • 23-06-2008 09:59AM
    #1
    Closed Accounts Posts: 30


    Hi,

    I'm having difficulties listing all duplicate values of a database (in a subform). The Main form contains a dropdown box, listing all organisations (with the duplicates removed). The subform 'should' display all the revelevant personnel (contact info) in that organisation in a datasheet format, but will only list on value.

    How can I retrieve all the contact details for each person within the organisation in the subform?

    Thank you,

    :confused:


Comments

  • Registered Users, Registered Users 2 Posts: 15,079 ✭✭✭✭Malice


    ncarroll wrote: »
    Hi,

    I'm having difficulties listing all duplicate values of a database (in a subform). The Main form contains a dropdown box, listing all organisations (with the duplicates removed). The subform 'should' display all the revelevant personnel (contact info) in that organisation in a datasheet format, but will only list on value.

    How can I retrieve all the contact details for each person within the organisation in the subform?

    Thank you,

    :confused:
    What does your SQL query look like at the moment?


  • Closed Accounts Posts: 30 ncarroll


    Attached is a screen shot of the form. I the use to use dropdown box, select an organiastion, and access will display all contact detaails on datasheet (subform).

    query:

    SELECT Title, [Name 2], Name1, Position, Phone, [Phone 2], [Phone 3], Email
    FROM Organisation, contacts
    WHERE Organisation=Forms!cboMyComboBox.Text And organisation.ID=contacts.ID;

    Problem is that it opens textbox (.text); getting correct result though, but want it to work on select of dropdown item.

    How do I call this query, i.e. macro or row source, or........?

    :o


  • Closed Accounts Posts: 94 ✭✭Done and dusted


    So you want the select query to be based on the drop down selection yeah?


  • Registered Users, Registered Users 2 Posts: 15,079 ✭✭✭✭Malice


    Can you do Forms!cboMyComboBox.Value or Forms!cboMyComboBox.Item? Sorry, I don't have any experience with Access forms so that's just a guess.


  • Closed Accounts Posts: 94 ✭✭Done and dusted


    malice_ wrote: »
    Can you do Forms!cboMyComboBox.Value or Forms!cboMyComboBox.Item? Sorry, I don't have any experience with Access forms so that's just a guess.

    yeah thats what i was thinking but I wasnt sure if the value in the dropdown he wants i.e. to be in the select statement.


  • Advertisement
  • Closed Accounts Posts: 30 ncarroll


    Thanks for your help guys....

    but..


    Still can't get this - it must be some simple ,mistake. Attached is a shot of what I'm getting back - so annoying :mad: When I manually type in the Company nam,e, it opens a different table with all relevant details (Contact Details - name, phone, email, etc) of all the people in the organisation.


  • Closed Accounts Posts: 94 ✭✭Done and dusted


    can you post the code for this app, well the relavent section? wait...you did.

    eh try this

    WHERE Organisation=Forms!cboMyComboBox.Value

    set a breakpoint on this line and then check the value of Forms!cboMyComboBox.Value to see if it contains the actual value from the combo box


  • Moderators Posts: 52,119 ✭✭✭✭Delirium


    ncarroll wrote: »
    Attached is a screen shot of the form. I the use to use dropdown box, select an organiastion, and access will display all contact detaails on datasheet (subform).

    query:

    SELECT Title, [Name 2], Name1, Position, Phone, [Phone 2], [Phone 3], Email
    FROM Organisation, contacts
    WHERE Organisation=Forms!cboMyComboBox.Text And organisation.ID=contacts.ID;

    Problem is that it opens textbox (.text); getting correct result though, but want it to work on select of dropdown item.

    How do I call this query, i.e. macro or row source, or........?

    :o


    Try the following:
    SELECT Title, [Name 2], Name1, Position, Phone, [Phone 2], [Phone 3], Email
    FROM Organisation, contacts
    WHERE Organisation=Forms!MyForm.cboMyComboBox And organisation.ID=contacts.ID;
    

    On properties for the cboMyComboBox make sure the bound column is set to the appropriate column.

    Hope this helps.

    If you can read this, you're too close!



Advertisement