Results 1 to 7 of 7
  1. #1
    rivergum_23 is offline Novice
    Windows 7 32bit Access 2003
    Join Date
    Nov 2011
    Posts
    14

    Query Help Required

    Hi All,
    Just wondering if anybody can give me help to do the following. As you can see from the database, the query is set to display "Customer A" job from the Jobs table. (I'll add a form and combox to select which customer I want to query, report button etc but for the purpose of this example I'll leave as is) Then what I want to do is if there are jobs for Customer A in the jobs table to perform a query in the"Contacts" table on Customer A and return the email address in the report. Of course if there isn't any Customer A jobs in the table, nothing is required to happen. Sounds easy enough, but cannot quite work out how to do it. Please help!

    Thanks Heaps in advance,


    River
    Attached Files Attached Files

  2. #2
    R_Badger is offline Knows a few tricks
    Windows XP Access 2003
    Join Date
    Feb 2012
    Location
    Suffolk, UK
    Posts
    262
    I have downloaded your file, taken a look and made a few changes.

    By the looks of things you need to get up to speed on data normalisation.

    You labelled ID as your primary key, nice start, but not very descriptive, I have renamed the ID's to something relevant for each table.

    I then replaced you duplicate customer field in jobs, with the customer_ID

    I then created a relationship between the two.

    I then built a new query (easier than rebuilding the old one)

    I then built a new form.

    For customer I changed it to first name, last name as an example, however customer would work fine for a company name, but would be less than ideal for an individual (back to data normalisation)

    To sum up, I strongly recommend reading up on normalisation and database design before you progress too far, your tables and their structure will determine the ultimate success of failure of your project as well as determining the difficulty of updating it in the future.

    I recommend reading this on database normalisation
    http://www.barrywise.com/2008/01/dat...gn-techniques/
    Attached Files Attached Files

  3. #3
    rivergum_23 is offline Novice
    Windows 7 32bit Access 2003
    Join Date
    Nov 2011
    Posts
    14

    Query Help Required

    R_Bader,
    Thanks so much for your assistance, you time and effort is very much appreciated. The only problem is that I have to keep the tables in the same arrangement/format which I uploaded because the tables come from another software package and linked into Access via ODBC, so I cannot make any changes to the tables. With that in mind are you still able to get the information across to the report as you did in the updated access upload??

    Thanks Again,
    River

  4. #4
    rivergum_23 is offline Novice
    Windows 7 32bit Access 2003
    Join Date
    Nov 2011
    Posts
    14

    Query Help Required

    Hi Everybody,
    Is someone able to help me with this one?? Not sure if it's possible, but I will repost my intal msg;

    Hi All,
    Just wondering if anybody can give me help to do the following. As you can see from the database, the query is set to display "Customer A" job from the Jobs table. (I'll add a form and combox to select which customer I want to query, report button etc but for the purpose of this example I'll leave as is) Then what I want to do is if there are jobs for Customer A in the jobs table to perform a query in the"Contacts" table on Customer A and return the email address in the report. Of course if there isn't any Customer A jobs in the table, nothing is required to happen. Sounds easy enough, but cannot quite work out how to do it. Please help!


    Thanks Heaps in advance,
    River


    One thing to note is that I cannot change the format of the tables because this is how I receive the data from our ERP.

    Any help much appreciated.

    River
    Attached Files Attached Files

  5. #5
    recyan's Avatar
    recyan is offline Expert
    Windows 2K Access 2000
    Join Date
    Dec 2011
    Posts
    662
    In total agreement with R_Badger. Apart from that, in line with R_Badgers suggestion, just try a join on the Customer Field, perhaps something like below :

    Code:
    SELECT 
    	Jobs.ID, 
    	Jobs.Customer, 
    	Jobs.Part, 
    	Jobs.Qty, 
    	Contacts.Email
    FROM 
    	Contacts 
    	INNER JOIN 
    	Jobs 
    	ON 
    	Contacts.Customer = Jobs.Customer
    WHERE 
    	(((Jobs.Customer)="Customer A"))
    ORDER BY 
    	Jobs.Customer;
    If possible, definitely try to implement R_Badger's suggestion with whoever is giving you the data.

    Thanks

  6. #6
    rivergum_23 is offline Novice
    Windows 7 32bit Access 2003
    Join Date
    Nov 2011
    Posts
    14
    Recyan,
    Ended up getting a bit of help with this one and we come up with the same solution as you.

    Thanks a lot for your help

    River

  7. #7
    recyan's Avatar
    recyan is offline Expert
    Windows 2K Access 2000
    Join Date
    Dec 2011
    Posts
    662


    Thanks

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

Similar Threads

  1. Query wont average all required columns
    By jackyoung2012 in forum Queries
    Replies: 11
    Last Post: 03-22-2012, 11:56 AM
  2. combo box based subform and query help required!!
    By crustycrab101 in forum Forms
    Replies: 3
    Last Post: 05-03-2011, 01:39 PM
  3. Hello! Help required if possible please...
    By MarkGLyons in forum Access
    Replies: 21
    Last Post: 12-28-2010, 05:36 AM
  4. immediate help required
    By pdurgi in forum Access
    Replies: 1
    Last Post: 06-05-2009, 08:21 PM
  5. Object required
    By duckie10 in forum Access
    Replies: 1
    Last Post: 05-15-2009, 02:11 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