Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add item to query on subform for data entry

Status
Not open for further replies.

tyemm

Technical User
Feb 28, 2005
66
US
This should be basic, but I reinvent the wheel each time:

I have incidents and patients, tblIncident and tblPatient
Linked via a query with PatientID the PK, serving as a FK in Incidents, I want to have a form frmIncidentNew whereby I add a new Patient to tblPatients in a subform, then go directly to add the new Incident, linked to the new Patient.

Is that so difficult? I've been using an intermediate form, but it should not be necessary, I think.

Tnx,
Tom
 
Can a patient have multiple incidents? Or can an incident belong to multiple patients?

I am assuming the first. IF that is the case, why would you have the Incident form as the main form and the patients form as the sub form? I would think it should be the other way around so when you pull up a patient, you can see all incidents that belong to that patient.

Also, if there is a new patient, you add the patient to the main form. If not a new patient, but a new incident, you just add that to your subform. You have the ID's ok, but I think you need to rethink your forms.

Am I missing something?
 
Thanks, hneal98--

I've taken your advice. I suppose I was focusing on the fact that, from a data point of view, I'm interested in incidents, not patients. But I now have a patient main form, and an incident subform. So I add a patient to the patient table, then hit tab and that patient FK shows up in my incident table, just as I wish. I've got other issues, like form printing blank, and how to add a second incident for a particular patient, etc., but I'm on my way. Thanks.
 
No problem. Adding another incident should be easy with the subform since the patient is already created.
 
This works, because most of the time I am in fact adding a new patient record, then tabbing into the new incident subform, where the newly added patient-key information appears.

I would like to set up the add-new patient main form such that, if I attempt to add a patient record whose primary key already exists (called an MRN), instead of an error message about duplicate records, I will instead have the cursor move to the add new incident subform, with the existing patient-key information apparent.

I guess the general question is: how to get to the error trap for duplicate records, in a data entry form field for primary keys-no duplicate allowed?

Tom
 
The questoin at this point is how are you adding a new member? Are you clicking on a button that then presents a new form or are you using the CTRL-+ that moves you to a new record?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top