hi i am trying to create a application for doctors n have to enter all the information regarding the patients i am using access as the database n nw the problem is tat the doc is supposed to save the patient details n when he opens it again he shld be able to add new medicines n new appointments bt when i try entering all the details in one table it gives me an exception regrading duplicating a value of primary key n if i use two tables then they dont take the values as required plzzzzzz help

if i have to guess then you try to insert a value into the DB for a field that is primary that already exist. but would help ofc if you post the code snippet where the error shows up.

Welcome to the forum, sana.khatib20,
Did your read the rules at daniweb?
1.
Homework policy - Show your work please.
2.
How to use code tags? - Wrap up your source code with code tags.
3.
Use suitable title for the thread.

actually let me tell u in detail where the prob is i hav created a database n one table in it that takes up all the information about the patient e.g name ,address, ph.no etc.nw i also hav to manage if the patient has medical history the doctor should get a msgbox showing the history.so shld i create a new table n link both tables or add it in the same table.also there is a search option that will search the patient detail using the reg_no which is the primary key in the table.so i hav a prob deciding whether i shld create a new table for medical history n link both the tables or add it in the same table.also as the medical history has to be added prescribed drugs n appointments also hav to be added.so shld i create new tables for these both also or add them in the same table.tats my prob
plzzzzzzzzzzzzz help
i hav a deadline to finish or else i am finished

actually let me tell u in detail where the prob is i hav created a database n one table in it that takes up all the information about the patient e.g name ,address, ph.no etc.nw i also hav to manage if the patient has medical history the doctor should get a msgbox showing the history.so shld i create a new table n link both tables or add it in the same table.also there is a search option that will search the patient detail using the reg_no which is the primary key in the table.so i hav a prob deciding whether i shld create a new table for medical history n link both the tables or add it in the same table.also as the medical history has to be added prescribed drugs n appointments also hav to be added.so shld i create new tables for these both also or add them in the same table.tats my prob
plzzzzzzzzzzzzz help
i hav a deadline to finish or else i am finished

yes u need to create a seperate table ,so that the patient details is seperate and the medical history is seperate and maintain a seperate table for previous appointment table (with the drugs,and reg_no "it refers to the patient") and have seperate table for new appointment(with reg_no "it refers to the patient") so its clear

but then how do i link those tables.n how do i retrive the records.n nother thing is tat if i give reg_no as a primary key then it is not possible to enter medicines and appointments later i.e. next time when the patient comes coz the reg_no will be duplicated.
plz help

but then how do i link those tables.n how do i retrive the records.n nother thing is tat if i give reg_no as a primary key then it is not possible to enter medicines and appointments later i.e. next time when the patient comes coz the reg_no will be duplicated.
plz help

yes it is possible to enter the values later in the same table but with certain things to take care about. :

dont save the data with reg_no also.. but instead ask for the reg_no and then retrieve the data from the Database that is related to that reg_no and then update that table accordingly..
if u give some code snippet..then we will be able to help you more precisely.. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.