Click to See Complete Forum and Search --> : [RESOLVED] relationships=)
Coke
Jul 4th, 2007, 01:33 AM
How to relationships for database works.?
Any conditions needed for datalink.?
Care to explain anyone.?
Lord Orwell
Jul 4th, 2007, 02:42 AM
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.
Coke
Jul 5th, 2007, 01:00 AM
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?
Lord Orwell
Jul 5th, 2007, 01:18 AM
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.
Coke
Jul 5th, 2007, 02:37 AM
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. :p
Coke
Jul 5th, 2007, 09:01 PM
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!!
Lord Orwell
Jul 5th, 2007, 09:54 PM
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.
Coke
Jul 6th, 2007, 12:43 AM
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?
Lord Orwell
Jul 6th, 2007, 01:19 AM
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...
RobDog888
Jul 6th, 2007, 01:24 AM
What is it that you are trying todo? Database relationships are a big topic. Which db are you using?
Coke
Jul 9th, 2007, 09:50 PM
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. :eek2:
RobDog888
Jul 12th, 2007, 02:20 PM
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.
Coke
Jul 12th, 2007, 08:04 PM
ohoh. ic haha.i will give it a try =) . Thks. :thumb:
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.