By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,827 Members | 813 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,827 IT Pros & Developers. It's quick & easy.

HI good day to all... i have a problem on how to connect the 2 tables in a database?

P: 26
Im a college student, my program is a computerized enrollment system, Im using MS ACCESS database in connecting my VB6 program form. Inside i'd created two tables, named "tbstudentinfo" and "tbstudentfees". In my 1st table i renamed my fieldname to STUDENTNUMBER and STUDENTNAME on the second fieldname, then below i entered (0001) for studnumber and (Paul) for studname. The 2nd table is almost the same with the 1st table but i added another fieldname (STUDFEES) and entered 5000 below. But my problem is on how to connect the 1st table to the 2nd table, i mean in the 1st table i entered the student number and the name of the person who enrolled. Then in the 2nd table, student payment or fees i need only to type the student number "like a search engine" and it will automatically shows the name that i'd entered in my 1st table and that will show in my VB6 program form running mode then saved it in my database. So i need a simple sample code or a whole simple code or a sample related to this system that i can understand definitely the code. Before i forget im currrently using ADODC database MS ACCESS connection. I hope you understand my problem and share your precious knowledge to someone really need it the most, to become successful someday in programming and i promised that GOD will bless you, not once but twice. And Thanks in advance to those who read and post their helpful codes, from the bottom of my heart.

if you have a simple way like using MODULE just give a code that can easily understand x) cause i dont know how to use MODULE in connecting 2 tables in a single database.
Sep 3 '09 #1
Share this Question
Share on Google+
4 Replies

Expert 5K+
P: 8,127
to connect two tables at database level you need to use primary key and foreign key.
Sep 3 '09 #2

P: 26
last thing, u can share and send your vb6 program related to at mail id snipped your kind is much appreciated
Sep 4 '09 #3

P: 23
Do you actually need two tables here? Do students have multiple fees each? If you do need two tables you're going to want to do
Expand|Select|Wrap|Line Numbers
  1. tbStudInfo
  2. studno     studname
Expand|Select|Wrap|Line Numbers
  1. tbStudfees
  2. studno      studfee
then join them using primary and foreign keys on 'studno', as debasisdas said
Sep 4 '09 #4

P: 26
how to use a foreign key i only know the primary key
Sep 5 '09 #5

Post your reply

Sign in to post your reply or Sign up for a free account.