Results 1 to 6 of 6
  1. #1
    atbm is offline Novice
    Windows 10 Access 2007
    Join Date
    Aug 2017
    Posts
    2

    Querying linked tables

    Hi and thanks for reading.

    I work for a company which puts up posters for events in lots of different shops etc around my city. Every day I choose which posters should be put up I am trying to make a database I can query to see which posters have not been put up recently so need to be sent out now. I have a database with two tables: Posters, a list of all the posters and their ID number. The ID number can be shared by several posters and the names are all unique so the name is the primary key.



    The other table, PosterDays, is has the fields ID (autonumber primary key), Day (which is the date a poster was put up on) and Poster (the name of the poster). Each record is one poster put up on one day. The Poster field is looked up from Posters.Poster_Name so there is a 1:many relationship.

    I want to search for all the Posters in Poster_Name which have not been put up recently or even at all. How can I do this?

  2. #2
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Do not use the poster name as the primary key as this can change (due to spelling mistakes, etc.) - make an autonumber field such as PosterID and use this as the PK.

    Day is a reserved word, change it to PutUpDate or something.

    Why would an ID number be shared by multiple posters? It seems that you need an additional table (category?) so that multiple posters can link to one of those.

    The query will count the number of days since each poster was last put up, such as DaysSincePutup: Date() - Nz(PutUpDate)

  3. #3
    atbm is offline Novice
    Windows 10 Access 2007
    Join Date
    Aug 2017
    Posts
    2
    Day is not reserved - maybe you mean date? It's a reserved word.

    I definitely am happy using the poster name as the primary key . I have already considered what you say and the name does not change.. Due to our process for tagging poster photos, etc, it's much easier.

    The ID number is for the order - if a customer orders two kinds of posters they have the same ID. Creating an ID field needlessly would be unhelpful.

    I'm not sure, but I think your suggestion for the query works - thank you! It doesn't show posters that haven't been put out yet though. Is there a way to search one table for values in another table and display those not found?

    Thank you.

  4. #4
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    "Day" is also a reserved word because it is the name of a built in function.

  5. #5
    Micron is offline Very Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    a list of bad words, where, as noted, you will find "Day" but I post it here for its ongoing usefulness.
    http://allenbrowne.com/AppIssueBadWord.html
    Last edited by Micron; 08-03-2017 at 08:24 PM. Reason: fix link
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  6. #6
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664

    Now why didn't I think of posting the link???

    @ Micron ...

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

Similar Threads

  1. Replies: 8
    Last Post: 02-17-2017, 10:24 AM
  2. Multiple users querying linked tables
    By vadnagra in forum Import/Export Data
    Replies: 6
    Last Post: 09-21-2016, 01:31 PM
  3. Querying Three Joined Tables with Nulls
    By DHaedo in forum Queries
    Replies: 4
    Last Post: 06-21-2016, 11:09 AM
  4. Querying 2 or more tables
    By NewbieInCT in forum Queries
    Replies: 12
    Last Post: 05-11-2012, 09:49 AM
  5. Querying from 2 tables
    By egnaro in forum Queries
    Replies: 6
    Last Post: 01-28-2010, 06:30 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