473,397 Members | 2,056 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Selecting one customer from multiple choices

22
I have a table with Patient Information. The fields are:
Patient_Number
Patient_Last_Name
Patient_First_Name
I have another table that contains nursing notes. The fileds are:
Patient_Num
Subject
Nursing_Observation
I have a select query that is initiated upon opening a form. The query allows the user to choose the last name. The query criteria is:
Expand|Select|Wrap|Line Numbers
  1. SELECT Patient_Information.Patient_Last_Name, Patient_Information.Patient_Number, Patient_Information.Patient_Last_Name, Patient_Information.Patient_First_Name, 
  2. FROM Patient_Information WHERE (((Patient_Information.Patient_Last_Name) Like [Enter Last Name] & "*")); 
The query works. Except when there are multiple patients with the same last name i.e. Jones. I would like the user to select one patient's record to avoid potential entry errors. I have seen and can use a field Patient_Full_Name (=Patient_First_Name+" " Patient_Last_Name).

Also, I have seen VBA code that that uses Me. to select a record and populate a form. Do I need to utilize Me in VBA?
Thanks,
Carl23
Apr 30 '12 #1

✓ answered by NeoPa

I would suggest a ComboBox to filter the form with. The ComboBox would show the [Patient_Number], [Patient_First_Name] and [Patient_Last_Name], but would have the first column as a value. Thus, when an item is selected using all those three fields, the result is the [Patient_Number], which can be used to identify the record uniquely.

I would also go along with Nico's suggestion of using a subform though. Have the [Patient] table as the main form and the [Nursing Notes] table, linked on [Patient_Number] = [Patient_Num], as the subform. You can still have the unbound ComboBox, as described above, to help you find the patient you're interested in. This would typically be held in the Header section of the main form.

5 1474
Seth Schrock
2,965 Expert 2GB
Just curious, why do you have Patient_Last_Name in the query twice?

From your question, I'm guessing that you have a button that opens the form that is based on the query you listed which asks for the last name of the patient. If that is correct, then the results that you give (it doesn't work if there are multiple people with the same last name) would make sense as I believe that Access will automatically use the first record found in the query. What I would do is to create a search results form in datasheet view so that you can see what records are found in the query and then you can select one to open the patient form. I usually make the primary key a hyperlink so that when I click it, it runs the DoCmd.OpenForm command in VBA with the PK as the criteria.
Apr 30 '12 #2
nico5038
3,080 Expert 2GB
In general it's a problem to select people by name.
Not only the last name can be duplicate, but even the combination of last and fist name...

Thus I use a mainform with a subform holding all patients with their name, DOB, address and what ever might help to identify the correct patient.

You can add a filter field with a button, but you could also instruct the user to use the right-click pop-up (my favorite).
Next when they position the cursor on the row needed, they can press a button to Update, Print or Delete the patient. This button will than activate the form with the patients data.

Idea ?

Nic;o)
Apr 30 '12 #3
NeoPa
32,556 Expert Mod 16PB
I would suggest a ComboBox to filter the form with. The ComboBox would show the [Patient_Number], [Patient_First_Name] and [Patient_Last_Name], but would have the first column as a value. Thus, when an item is selected using all those three fields, the result is the [Patient_Number], which can be used to identify the record uniquely.

I would also go along with Nico's suggestion of using a subform though. Have the [Patient] table as the main form and the [Nursing Notes] table, linked on [Patient_Number] = [Patient_Num], as the subform. You can still have the unbound ComboBox, as described above, to help you find the patient you're interested in. This would typically be held in the Header section of the main form.
Apr 30 '12 #4
Carl23
22
I added the combo box in the header and have the form showing the patient number and full name. The Patient Information table is linked to the subform Nursing observation. How do I have the Patient Infomation and Nursing observation records only show the patient records related to the clicked on record from the combo box? Is this a on click event procedure?
Thanks,
Carl23
May 1 '12 #5
NeoPa
32,556 Expert Mod 16PB
Carl23:
Is this an on click event procedure?
Indeed it is. Either that, or an AfterUpdate() event procedure ().

See Example Filtering on a Form for an article explaining things for you in full.
May 2 '12 #6

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

Similar topics

1
by: Andy S. | last post by:
Hi, I'm running DB2 V 7.1 and I wish to write a SELECT query that queries tables in multiple tables in different databases on the same instance. Is this possible and if so, what should the FROM...
2
by: Jen F. | last post by:
I have inherited a medical database in which there are multiple values stored in a single field (ie. "Current Conditions" field might contain 1-20 different conditions, separated by comma (ie....
2
by: Henrik Goldman | last post by:
Hi there, I'm new to sql and thus I'm having problems with a specific query which I hope you guys can help me with. Basicly I have a few tables which I'm trying to do a query on: Table...
1
by: mariusftc | last post by:
Hello How do I extract out of a DB only those records that have values wich repeat themselves? I need to select(extract) from a table only the records who has duplicates values! How would the...
2
by: hemashiki | last post by:
hi i want to select multiple choices in listbox using ctrl key can any one suggest....plz
3
by: Swizylstik | last post by:
Can anyone guide me in how to create a document that will allow a user to choose via checkboxes which files they would like to download and then have the download occur concurrently? In other words,...
1
by: Brita | last post by:
I am sure there must be an easy answer to this, but I can't find it. I have to process a form where people can request information on one or more communities from a drop-down box. I bring the...
9
by: Musty | last post by:
...And literally the only thing holding me back is how I 'switch between forms' is the best way to describe it. If anyone here has done an online test or something - you know when you select the...
2
by: descarre | last post by:
I greatly appreciate your help as I have been trying to come up with the correct sql statement but output is inaccurate. How do you write the correct t-sql statement for the following: SELECT...
3
by: entangled | last post by:
What do they call something like this ... <?=(($data->link_place == "T") ? "Top bar":"Main menu bar")?> ... it's sort of a if /else statement. But what if there are three possiblities T =...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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,...
0
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...

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.