Results 1 to 13 of 13

Thread: [RESOLVED] relationships=)

  1. #1

    Thread Starter
    Junior Member Coke's Avatar
    Join Date
    Mar 2007
    Posts
    31

    Resolved [RESOLVED] relationships=)

    How to relationships for database works.?
    Any conditions needed for datalink.?
    Care to explain anyone.?

  2. #2
    coder. Lord Orwell's Avatar
    Join Date
    Feb 2001
    Location
    Elberfeld, IN
    Posts
    7,628

    Re: relationships=)

    i can give a small primer:
    a relationship is a link between one table and another.
    Say you had a table full of softdrinks(with a primary key)
    and another table with a list of names and the softdrink they like.
    since more than one person can like the same softdrink, the softdrink table would have a one-to-many relationship with the drinker table
    a one-to-one relationship is basically like having a list of cars and a list of license plates with a common index number. Each car only has one number assigned to it, and each plate only goes on one car. That is a one-to-one relationship.
    A many-to-many is the final type of relationship. An example would be a menu at a restaurant related to customers. Each customer could want any thing off of that menu and each menu item could feed any customer,so the menuitem table would have a list of customer reference numbers and there could be duplicates because a particular customer could like more than one menu item, and the customer table could contain duplicate entries in the reference to the menu table because a particular menu item could be the favourite of multiple customers.

    I hope this helps a little.
    Basically a one to one no duplicates allowed on either side
    one to many, duplicates allowed on one side but not other
    many to many, duplicates on either side.
    My light show youtube page (it's made the news) www.youtube.com/@lightsofelberfeld
    Contact me on the socials www.facebook.com/lordorwell

  3. #3

    Thread Starter
    Junior Member Coke's Avatar
    Join Date
    Mar 2007
    Posts
    31

    Re: relationships=)

    thanks, Lord Orwell.
    Basically, you explained to me what are the different types of relationships to link tables right?
    I think i understand this part.
    What if 2 tables, both have primary keys, but the primary keys aint the same, but the names are the same, although some may not be in the 2 tables, can i link them together.? just linking the names together?

  4. #4
    coder. Lord Orwell's Avatar
    Join Date
    Feb 2001
    Location
    Elberfeld, IN
    Posts
    7,628

    Re: relationships=)

    a relationship doesn't have to be between primary keys. You can choose any column when creating the relationship. I believe you would NOT enforce referencial integrity in this case because data doesn't match in all of them. There is also what's known as an append query that stacks all the data together. Useful for pulling data from two tables and making a 3rd out of it.
    My light show youtube page (it's made the news) www.youtube.com/@lightsofelberfeld
    Contact me on the socials www.facebook.com/lordorwell

  5. #5

    Thread Starter
    Junior Member Coke's Avatar
    Join Date
    Mar 2007
    Posts
    31

    Re: relationships=)

    that sounds right. haha. ok. i gonna try this, without the referencial integrity. After this, i would have to try and to display the correct data in CR.

  6. #6

    Thread Starter
    Junior Member Coke's Avatar
    Join Date
    Mar 2007
    Posts
    31

    Re: relationships=)

    hmmm. i have successfully changed the relationship. I can see the link in my Access Database, but there isnt any change in the VB.
    How can i link the database properly to the VB.?
    Any one HELP!!

  7. #7
    coder. Lord Orwell's Avatar
    Join Date
    Feb 2001
    Location
    Elberfeld, IN
    Posts
    7,628

    Re: relationships=)

    I wish i could help. The only database use i do is in Access. There are a couple of self-proclaimed Office Gurus on the forum. Start a new thread in Office Development and i am sure you won't have to wait long. One of them is on every day.
    My light show youtube page (it's made the news) www.youtube.com/@lightsofelberfeld
    Contact me on the socials www.facebook.com/lordorwell

  8. #8

    Thread Starter
    Junior Member Coke's Avatar
    Join Date
    Mar 2007
    Posts
    31

    Re: relationships=)

    hmm. i think the problem now is more on the VB side ya. cause VB cant seem to recieve the updates that i have made. Do i have to like remap the directory of the database? Copy the database to other folders in the Project?

  9. #9
    coder. Lord Orwell's Avatar
    Join Date
    Feb 2001
    Location
    Elberfeld, IN
    Posts
    7,628

    Re: relationships=)

    must be some way to refresh it. a flush command? When you work with databases inside Office, the stuff is automatically saved as you are typing.

    If you open it up in Access is the change there? If so, try closing the link and reopening. Now i don't know if this is the best way or not. Let me see if a guru is on line...
    My light show youtube page (it's made the news) www.youtube.com/@lightsofelberfeld
    Contact me on the socials www.facebook.com/lordorwell

  10. #10
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: relationships=)

    What is it that you are trying todo? Database relationships are a big topic. Which db are you using?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  11. #11

    Thread Starter
    Junior Member Coke's Avatar
    Join Date
    Mar 2007
    Posts
    31

    Re: relationships=)

    i am using Microsoft Access. I am trying to link tables together so they can see each other data based on a primary key(or other fields if possible). The problem now is that i can somehow link them together, not by primary key, just by a field with the same company name, and in access i can see the link, and it can browse the data from the other tables. BUT, in VB, i am doing reporting too, i search and display the results in a crystal report, this is where the data needs to be taken from the database. The data extracted is not the right data, that i have linked in the database. I tried refreshing the connection, but it didnt work. So, i am in a big mess.

  12. #12
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: relationships=)

    Just because you link them in the db doesnt mean that any query from CR or other will return that same structured data. You need to create the query with the proper design to return what you want.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  13. #13

    Thread Starter
    Junior Member Coke's Avatar
    Join Date
    Mar 2007
    Posts
    31

    Re: relationships=)

    ohoh. ic haha.i will give it a try =) . Thks.

Posting Permissions

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



Click Here to Expand Forum to Full Width