Results 1 to 9 of 9
  1. #1
    Join Date
    Feb 2013
    Posts
    2

    Unanswered: Little help for a beginner

    Hi guys, I'm new to microsoft access and datebase at all, but i got this school assignment and I feel like everything is so hard with this datebase stuffs. However I had to make a datebase for a flower shop. Everything is good by now but I cant make the relationship work. Here is the file Database81.accdb download - 2shared
    Can you just take a look and tell me how to do it or even easier, you do it

  2. #2
    Join Date
    Sep 2006
    Location
    Surrey, UK
    Posts
    995
    Provided Answers: 2
    I can't download the database at work - the site is blocked. Even if I could, I wouldn't do your homework for you, because what would be the point?

    If you're having trouble making the relationships work, spell it out a little bit. Where are you having the trouble:
    • Working out which tables to relate to each other?
    • Working out which fields link two related tables together?
    • Getting 'Primary key violation' error messages?
    • The whole concept of relational integrity?
    • Something else entirely?


    I have found this forum to be a wealth of helpful information, but you have to ask the right questions! :P
    If you are specific about your problem, someone here will be able to point you in the right direction to fix it.
    10% of magic is knowing something that no-one else does. The rest is misdirection.

  3. #3
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    there is no primary key in clients
    when creating relationships you are better off defining them as relational (select the enforce relational integrity)
    Im surprised you only allow a single product per order
    Im surprised you don't allow a customer to by multiple
    you are storing age, rather than date of birth, which means you data is alwasy at risk of being redundant
    in the real world you may struggle getting either age or date of birth from customrs, especially women. you need to think if you really need to store or request such personal details from a customer.

    as to
    Everything is good by now but I cant make the relationship work
    I don't understand. can you describe what the problem is, what steps you have taken to resolve it.
    I'd rather be riding on the Tiger 800 or the Norton

  4. #4
    Join Date
    Feb 2013
    Posts
    2
    Yeah, that's what I'm finding hard because when I try to select the enforce relational integrity when I make the relationships but "no unique index" error shows and I dont know what to do, I mean I looked up in internet before I asked for help here and I did everything I could so can someone do it or tell me how to do it and what's wrong with it.

  5. #5
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    as said before
    here is no primary key in clients
    solution:- create a primary key in table clients. a relational database using relational integrity requires a mechanism that can uniquely identify a single row... so create one

    then I'd strongly recommend that you convert your existing relationships to RI ones. however you may have a problem if you have already got data in which breaks those rules. of so delete /edit that data so you can apply RI.
    I'd rather be riding on the Tiger 800 or the Norton

  6. #6
    Join Date
    Sep 2006
    Location
    Surrey, UK
    Posts
    995
    Provided Answers: 2
    In order to enforce referential integrity in a relationship between two tables, the following conditions must be met:
    • There must be a primary key (indexed field or field; each record has a unique value or combination of values within this index) on at least one side of the relationship
    • The fields that form the relationship must be of equivalent data types (i.e. you cannot link a numeric field to a text field)
    • If the fields contain data before you define the relationship, there can be no orphan records (i.e. each record in one table must have an equivalent record in the other table)

    If you are trying to define a relationship between tables after populating them with data, the error messages that you get will be useful. In the one that you cite, you need to define a primary key in one of the tables first. Once you have done that, you will be able to define your relationship. Or you will get another error that will guide you on what to do next.
    10% of magic is knowing something that no-one else does. The rest is misdirection.

  7. #7
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Quote Originally Posted by weejas View Post
    [*]The fields that form the relationship must be of equivalent data types (i.e. you cannot link a numeric field to a text field)
    Just note that if one field is defined as an Autonumber the other one must be defined as a Number/Integer, not as an Autonumber.

    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  8. #8
    Join Date
    Sep 2006
    Location
    Surrey, UK
    Posts
    995
    Provided Answers: 2
    Technically, Autonumber is a Jet-controlled Long Integer :P

    But yes, point well made.
    10% of magic is knowing something that no-one else does. The rest is misdirection.

  9. #9
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    I know that, and you know that, but over the past seven years, I've answered about a gazillion posts wondering why assigning an Autonumber both as a Prime Key and a Foreign Key "keeps giving me an Type Mismatch Error!" Just thought I'd throw that in!

    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •