473,698 Members | 1,952 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do I create 2 forms, with form 2 selectively populating data from form 1 based on

4 New Member
So I'll explain to you everything that I'm doing and then let you know what I need help with b/c maybe I should be doing this a different way.

I am trying to create a database for all patient samples that come into the lab that I work for. I'm using access to do this. When a sample comes into the lab, the tech has to record all the information on to a paper log. The tech labels it with a unique number (moving forward I will call this the Sample Number), no two samples ever have the same sample number. Then on that log the tech will also record what the testing is being done for and then the methods/equipment/procedures going to be done to do the testing

Ex. patient sample comes in, needs to be tested for Antibody A, and a DNA extraction, PCR and a Lab Screen Class 1 test will all be performed.

So what I have so far is:

Table 1: Patient Sample Information (including demographics of each patient sample, investigation type (Platelet or Antibody), methods/procedures going to be used to test the sample.
Form 1:This is where the techs will actually input all that data (replacing the paper log). 3 sections 1) Patient info 2) what they need to find out 3) How they're going to do it
Table 2: Results for all testing performed
Form 2: This I am currently working on and I'm stuck! Lol!

The sample number is the primary key in both these tables and I've created a 1-1 relationship between them.

THE BIG ISSUE: Form 2!

Form 2 needs to be associated with form 1 to some extent. I need fields from form 1 to be in form 2 but only as read only and some only if the data was entered in form 1, otherwise I dont want the empty visible fields there.

3 Sections for Form 2:

Section 1: Patient info (Want this to autopopulate from form 1)
Section 2: Testing performed (I want only those values to autopopulate if there were selected)
Section 3: Results (This is actual data entry for form 2, all results need to tabulate in Table 2)

I want the tech to be able to enter a sample number and the record for that sample to pop up and sections 1 and 2 will be visible so you know you have the right sample you are entering results for. So display that information and then in section 3, enter the results.

So now, only the data you enter in form 2, I want it to appear in Table 2. I don't want the sections 1 and 2 to repeat in Table 2 since they are already linked with the same sample number.

What I've been able to do:

In form 2 I am able to have fields from Tables 1 and 2 there, but I do not know how to associate them so the data in Table 1 populates that info into Form 2 as visible. Also, I don't know how to do a lookup for the sample number and have that record pop up with the populated data in form 2.

Essentially, when data is entered in form 1 a record is created in Table 1. Now I want that to also create a record in table 2 but the only field in table 2 to have data populate would be the sample number b/c the rest of the fields are for results. so a record with a sample number only and the other fields blank be simultaneously created in table 2 when form 1 is completed.. when form 2 opens I want the tech to be able to enter a sample number (which should already exist in table 2 ) see data from table 1 (somehow associate that data to populate as read only) and then enter results data which gets recorded in Table 2.

I hope this makes sense. I have no programming experience, I am learning a bunch of this stuff as I go, I've done basic coding in my first form, nothing crazy, second form I feel will be crazy just because of how i want everything. It should be possible though right???

Please ask me any questions if you are confused. And thank-you so much! I appreciate any and all insight you have on this.

Also, maybe I need to approach this with subforms?? I made a copy of form 1 and trying to put form 2 as a subform in it, but I still have the issue of seeing everything in form 1. I only want the values that were initially entered in form 1 to populate as visible in the copy of form 1. I would prefer to have 2 separate forms but I don't know what would work best.


Thanks again!
Sep 5 '13 #1
2 1917
zmbd
5,501 Recognized Expert Moderator Expert
Amian

That's going to take quite a while to weed thru!

On first pass, there appears to be multiple questions. To help keep threads from becoming too jumbled we ask for a single question per thread. If you would please, take a deep breath, go back thru your first post, and select the most pressing issue you have - we won’t ignore the rest (intentionally anyway (^_-) ), we just need to select a path to follow.
There's already a lot of information in the first post, so just a two sentence question/statement should do.

Because it sounds like you are in the same boat with a fellow member, you may also benefit from the information I gave in the last paragraph here: POST#4 Need help... there is a link to a very basic Access tutorial and links within Bytes.com that will help you.
Sep 5 '13 #2
zmbd
5,501 Recognized Expert Moderator Expert
You didn't mention which version of Access you are working with... each has their own quirks and you'll find that most of us have upgraded to ACC2007/2010/2013.
You have several questions running there and a lot of tiny things that need to be tweaked with your database design. You need to find a good tutorial site and read thru: > Database Normalization and Table Structures.

Based on that normalization concept; here is how I would set up your database table structure:
For the following:
Each starts with the table name.
field names within the table are in square brackets []
parameters for the field follow the field name either directly or below.
[*_PK] designates the primary key.
[*_FK_*] designates a foreign key to the indicated table, usually one to many (1:M) or as designated.


tbl_patient
[patient_pk] autonumber
[patient_fname] text(25) required
[patient_lname] text(25) required
[patient_fx_sex] numeric long (because this is medical, sex may play a part due to genetic roles - useing a relationship here to limit valid entry)
[patient_FK_race] numeric long (because this is medical, race may play a part due to genetic role.)
[patient_...] additional fields for unchanging patient only information.

tbl_staff
[staff_pk] autonumber
[staff_fname] text(25) required
[staff_lname] text(25) required
[staff_...] additional fields for unchanging staff only information.

tbl_diagnostic
[diagnostic_pk] autonumber
[diagnostic_name] text(25) required
[diagnostic_lowr ange] numeric - if decimal then double else long
[diagnostic_high range] numeric - if decimal then double else long
[diagnostic_...] additional fields for unchanging diagnostic information only

tbl_specimen
[specimen_pk] autonumber
[specimen_fk_pat ient] numeric long 1:M with patient
[specimen_fk_pri ority] numeric long 1:M with priority - using a relationship here to limit valid entry)
[specimen_dateti mereceived] date/time
[specimen_fk_sta ff] numeric long 1:M with staff (you should know who received the specimen)

tbl_labresults
[labresults_pk] autonumber
[labresults_fk_s pecimen] numeric long
[labresults_fk_d iagnostic] numeric long
[labresults_fk_s taff_assignedto] numeric long
[labresults_fk_s taff_reporting] numeric long
[labresults_fk_s taff_reviewed] numeric long
[labresults_repo rteddatetime] date/time
[labresults_revi eweddatetime] date/time
[labresults_resu lt] numeric double

tbl_diagnostic and tbl_labresults assume that the results are all quantifiable as a numeric value.

You could do this with a tabbed form or a single form for most things.

You say you have no programming experience; thus, I'd go with the ParentForm(Subf orm1(Sub_Subfor m)) approach as it should help minimize the code you will need.

Parent form:
Would have the patient id, first, and last names.
This could be either as a single record or datatable display.
You could have a details form popup should you need to add a new patient to the database. This could be via a on_click event from a button or control, or you could do this via an on current event checking for new record and trapping the normal method to popup the details form. I would have all of the fields set for an on click event to bring up the details form.
In anycase, parent form would be linked to the first child form subform, "CF1" on the [patient_pk] and [specimen_fk_pat ient] fields so that you only see the patient specfic specimens.
You could even use some things from the following as weo:
Now the trick, the second subform, this is a subform on CF1, call this grandchild form GC1. It has the tbl_labresults as the ultimate record source and is linked to CF1 on [specimen_pk] and [labresults_fk_s pecimen].

All of the forms will be driven by queries so that we can pull all of the nice human readable stuff into lookup fields (I don't use lookup fields at the table level)

So the work flow goes like this:
Either by the built in search, or by a control on the parent form the patient id is found, or the patient is found by means of first and last name. You may need additional field for something like driver's liscence. Stay away from SSN and other such sensitive information if possible.
If the patient id is not found or the person cannot be located by other id, then a new patient record is created via the detail form.
Since this will be parent current record, all of the currently logged specimens should show in CF1. Either enter a new specimen or select one. I would use the PK field as your specimen id; however, you can add a field to the table that has the unique id value; however, that either means more VBA or some other means of creating ID numbers.
Once a specimen has been selected/entered then the labresults should show in GC1 for any diagnostics scheduled. New tests can be entered into the GC1 for the currently selected specimen.
You can then develop queries to pull information by patient, specimen, etc...

The worst VBA will be traping the on_current event for newrecord and the on_click event for the parent form to bring up the details form. Strickly speaking, you don't need the details form; however, I think this main data entry form would become very busy.

Sorry, I don't have the time resources available to design you an example database; however, I hope this will give you some ideas on how to proceed with your project.
Sep 9 '13 #3

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

Similar topics

2
1792
by: Eric Sessoms | last post by:
I am trying to create forms on the fly in strict xhtml using javascript. I won't bore you with why, but I should mention that I'm only interested in the very latest versions of Mozilla based browsers. The basic problem is that the forms do not display. I've included a minimal sample below that illustrates this. It validates, I get no javascript errors at run time, and most disconcerting of all is that the DOM tree looks right after...
4
2138
by: Terry | last post by:
I need some help refining an MS 2000 relational databse. I have created a simple relational database using two tables, 'Student Details', 'Exam Details' and two forms, 'Input/Edit Exam Details', 'Input/Edit Student Details'. 'Student Details' has a field called 'Log Book No' (no duplicates allowed) and this is the Primary Key. 'Exam Details' also has a field called 'Log Book No' (duplicates allowed) and has no Primary Key, (as each...
1
2402
by: jbroome | last post by:
I have several tables that contain the same information as Identifying records but then with additional info that differs from table to table. e.g. 1 database of school students with their relevent info Another dbase with subject info and grades etc assigned to the students info I wish to use one form to enter data into all tables. The differing infos not a problem but I am unable to input Firstname and Surname
4
2187
by: Lumpierbritches | last post by:
Thank you once again for any and all assistance. I'm building an application that's getting quite bulky due to the number of forms, macros and procedures. I was wondering if there's a way to use 1 (one) unbound form, if all the fields are the same for multiple forms populating them with Queries? I have a makeshif menu form with command buttons and I would like to eliminate all the forms and replace them with one unbound form for three...
3
2530
by: R. Hopping | last post by:
What's the easiest way to convert an access form to to a web based Front end ? Is there any software that can convert these formats easily? If not any Beginer tutorials would be helpful. Than you
1
2933
by: Jeff Brown | last post by:
I am developing my First "Real" app and i am running in to the following problem. I use the data form wizard to create a form, so i do not have to manually do all the binding. But the only thing i want the user to be able to do on this form is Add a record. I tried moving the fill dataset in to the form load to get rid of the "load" button and that worked but it also loads data into my textboxes. Ok i could code around that ....
2
5055
by: filbennett | last post by:
Hi Everyone, I'm generally unfamiliar with Access form design, but have programmed Cold Fusion applications for a couple of years. I'd like to build a data entry form in Access that allows the following. First, the data schema: Three tables are involved. The first is a PERSONS table which has two fields, SSNUMBER (primary key), and NAME.
1
1914
by: emmaruwa | last post by:
I have a form with two text boxes (in its details section) that pull data from two fields in my database table. This same form also has a button beside the text boxes which is supposed to open another form and populate that form with a record from the table using the data in the previous two text boxes as record selection criteria. However, it seems Access 2003 only uses one of the 2 text box data as criteria, i.e., no provision for using two...
1
1455
by: campbellbrian2001 | last post by:
I have a form with a sub-form (in continuous forms view to simulate a datasheet view) from which the user can double-click a product number and open a new form which will display that number and lookup all its details (about 30 fields) which will display also. I first tried this code on the textbox of the subform (using the on doubleclick event): !! = !! ! _ to populate the textbox only for the detail form, which it did sucessfully, but...
2
4446
by: zufie | last post by:
I must combine the information from two forms/tabs on a main form. The idea is to insert two checkboxes on the main form. Then based on the checkbox checked would then automatically highlight those textboxes that need to be filled in by the end user. Any advice on how best to do this? Thanks!
0
8668
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8598
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8855
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7708
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6515
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5857
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4358
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2320
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1995
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.