•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the MS Access and FileMaker Pro section within the Web Development category of DaniWeb, a massive community of 397,808 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,510 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MS Access and FileMaker Pro advertiser:
Views: 3787 | Replies: 1
![]() |
•
•
Join Date: Dec 2006
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
Hi! I am creating a database for a class. It is supposed manage the hospitals Drug inventory as well as the patient's information and what patient is on what drug. I created a drug table (with drug_id, num_in_stock, and num_prescribed) and a patient table (with patient_id, name.. blah blah blah) and a patient drugs table(linking drug_id and patient_id.. it also containg the columns quantity and times daily). the patient drugs table manages all the drugs each patient in the hospital is on as well as how many they are prescribed each day.
i want an error message to pop up when attempting to put a patient on a drug that they already are on. i am assuming i have to make a composite key (combining patient_id and drug_id within the patient drug table) .. i DO NOT KNOW HOW TO CREATE COMPOSITE KEYS and i DO NOT KNOW HOW TO SET RESTRICTIONs ON THEM... you can tell i'm frustrated with this.. LOL
also... i'm trying to keep an updated inventory of all the drugs. i'm having trouble decreasing the num_in_stock in my drugs table using an update query. does anyone have any information on how i can keep an updated inventory in access every time a patient is put on a drug?? am i making any sense?
thanks!!
-the lost and confused
i want an error message to pop up when attempting to put a patient on a drug that they already are on. i am assuming i have to make a composite key (combining patient_id and drug_id within the patient drug table) .. i DO NOT KNOW HOW TO CREATE COMPOSITE KEYS and i DO NOT KNOW HOW TO SET RESTRICTIONs ON THEM... you can tell i'm frustrated with this.. LOL
also... i'm trying to keep an updated inventory of all the drugs. i'm having trouble decreasing the num_in_stock in my drugs table using an update query. does anyone have any information on how i can keep an updated inventory in access every time a patient is put on a drug?? am i making any sense?
thanks!! -the lost and confused
•
•
Join Date: Aug 2005
Location: near St Louis, Missouri, USA
Posts: 10,643
Reputation:
Rep Power: 36
Solved Threads: 867
You have a drug table that describes the drugs, and patient table that describes the patients, but you do not have a table that contains drugs that has been prescribed to each patient. you will probably need a prescripton table
There would be multiple rows in this table for any given patient. Here is where you would use composite key -- patient_id and drug_id would be the unique key.
Then its a simple lookup to see if a patient has already been prescribed a given drug.
>>does anyone have any information on how i can keep an updated inventory in access every time a patient is put on a drug
Shouldn't the drug table be updated when a prescription is filled ? Doctor writes a prescription with three refills. The drug table should be updated each time a refill is made, not when the prescription is first made.
I don't know what programming language you are using, but it will first have to query to find out the current quantity, reduce it by some amout, then update the table with the new value.
patient_id drug_id quantity etc
Then its a simple lookup to see if a patient has already been prescribed a given drug.
>>does anyone have any information on how i can keep an updated inventory in access every time a patient is put on a drug
Shouldn't the drug table be updated when a prescription is filled ? Doctor writes a prescription with three refills. The drug table should be updated each time a refill is made, not when the prescription is first made.
I don't know what programming language you are using, but it will first have to query to find out the current quantity, reduce it by some amout, then update the table with the new value.
Last edited by Ancient Dragon : Dec 12th, 2006 at 3:10 pm.
I think it's about time we voted for senators with breasts. After all, we've been voting for boobs long enough. ~Clarie Sargent, Arizona senatorial candidate
Those who are too smart to engage in politics are punished by being governed by those who are dumber. ~Plato
Those who are too smart to engage in politics are punished by being governed by those who are dumber. ~Plato
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb MS Access and FileMaker Pro Marketplace
- Writing to an Access Database (Visual Basic 4 / 5 / 6)
- VB: Connect to Access database via ODBC datasource name (Visual Basic 4 / 5 / 6)
- Running a VB application with MS Access database (Visual Basic 4 / 5 / 6)
- Create an Access Database using Java (Java)
- Writing to an Access Database using Java... (Java)
Other Threads in the MS Access and FileMaker Pro Forum
- Previous Thread: From "Word" to "Access" automatically
- Next Thread: Need Help - Converting Access to Web DB - Mostly Newbie



Linear Mode