473,408 Members | 2,030 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,408 software developers and data experts.

Adding data to a field from combo box

I am creating a database for inputing ambulance run sheets. I have a table that lists different history conditions (HTN, CHF, Asthma....) In my main report form, I have a combo box that gets its' list from that table.

I want to be able to select from the list and then hit a command button next to it that adds the current data to another field, labeled history. I then want to be able to make another selection from the same combo box and add to that same history field without erasing what was there. If it's possible to add a comma between the selections, that would be beneficial too. I could live with spaces, which could be added in the original table.

So, the final field value would end up having multiple history data in one field, looking something like this------- Asthma, CHF, HTN,

I have figured out how to copy data from one field to another with the Me.xxx1 = Me.xxx2 script, but that overwrites what was there. I want to keep the current data and add to the list.

I'm sure this is possible, but have not been able to find info on how to accomplish this. I appreciate any help that can be given.

Thank you!!
Mike Busby
Dec 20 '07 #1
10 4072
missinglinq
3,532 Expert 2GB
This should do it:

Expand|Select|Wrap|Line Numbers
  1. Private Sub YourComboBox_AfterUpdate()
  2.   If IsNull(Me.History) Then
  3.    Me.History = YourComboBox
  4.   Else
  5.    Me.History = Me.History & "," & YourComboBox
  6.   End If
  7. End Sub
Welcome to TheScripts!

Linq ;0)>
Dec 20 '07 #2
Rabbit
12,516 Expert Mod 8TB
That's not a good design for it however. You should have a another table that is related to this table that lists the illnesses for each person in a separate records.
Dec 20 '07 #3
missinglinq
3,532 Expert 2GB
It really depends on what you're using it for, Rabbit. If you're going to want to manipulate the data, i.e. calculate how many patients with Asthma are transported, how many with COPD, etc. then yes, you'd be better off doing as you say. If the only point is generating a report of a single ambulance run, then a memo field box is just fine and what you suggest is overkill.

Linq ;0)>
Dec 20 '07 #4
Rabbit
12,516 Expert Mod 8TB
It really depends on what you're using it for, Rabbit. If you're going to want to manipulate the data, i.e. calculate how many patients with Asthma are transported, how many with COPD, etc. then yes, you'd be better off doing as you say. If the only point is generating a report of a single ambulance run, then a memo field box is just fine and what you suggest is overkill.

Linq ;0)>
True, it would be overkill. I just like to plan for the worst. You just know someone's going to ask for that information at some point.
Dec 20 '07 #5
missinglinq
3,532 Expert 2GB
But if everybody planned ahead, we would have just passed our 6ooth post, instead of our 60,000th post!

Linq ;0)>
Dec 20 '07 #6
This should do it:

Expand|Select|Wrap|Line Numbers
  1. Private Sub YourComboBox_AfterUpdate()
  2.   If IsNull(Me.History) Then
  3.    Me.History = YourComboBox
  4.   Else
  5.    Me.History = Me.History & "," & YourComboBox
  6.   End If
  7. End Sub
Welcome to TheScripts!

Linq ;0)>
I will try this code when I get back to work. If things go right, I will not return for another week.

I wouldn't expect that we would run a report on past medical illnesses, so this should be perfect. If we ran a report, it would be off of what the current illness is, and that would be another field (Chief Complaint) with a single entry.

Once again, I appreciate the feedback.

I hope you all have a Merry Christmas and Happy New Year.

God Bless!!

Mike Busby
Dec 21 '07 #7
Rabbit
12,516 Expert Mod 8TB
I will try this code when I get back to work. If things go right, I will not return for another week.

I wouldn't expect that we would run a report on past medical illnesses, so this should be perfect. If we ran a report, it would be off of what the current illness is, and that would be another field (Chief Complaint) with a single entry.

Once again, I appreciate the feedback.

I hope you all have a Merry Christmas and Happy New Year.

God Bless!!

Mike Busby
That's what you think. $5 says someone will want that report within a year. Good luck though.
Dec 21 '07 #8
missinglinq
3,532 Expert 2GB
Having run with volunteer and professional EMS agencies, in my youth, I suspect you're right, Mike, and chief complaints would be all anyone would be interested in! If you included all Dx the forests would be in more danger than there already are!

Have a great holiday!

Linq ;0)>
Dec 21 '07 #9
This should do it:

Expand|Select|Wrap|Line Numbers
  1. Private Sub YourComboBox_AfterUpdate()
  2.   If IsNull(Me.History) Then
  3.    Me.History = YourComboBox
  4.   Else
  5.    Me.History = Me.History & "," & YourComboBox
  6.   End If
  7. End Sub
Welcome to TheScripts!

Linq ;0)>
I used this code and it works great. I wanted to thank everyone for their input. It's sites like these that make the internet so valuable.

Mike
Jan 6 '08 #10
missinglinq
3,532 Expert 2GB
Glad we could help!

Linq ;0)>
Jan 6 '08 #11

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

Similar topics

6
by: Robin S. | last post by:
**Eric and Salad - thank you both for the polite kick in the butt. I hope I've done a better job of explaining myself below. I am trying to produce a form to add products to a table (new...
6
by: 6thirty | last post by:
Hi, I've created a stocktaking database using Access XP. This is indexed by two fields - part number and shelf location. I am currently inputting all the data via a form. When I have entered a...
12
by: Nhmiller | last post by:
When I start to type the data for a new record, I would like a dropdown box to open next to it from which I can choose the data from a previously entered record that starts with the same letter....
3
by: MS | last post by:
What's the best way to "store" and display a value in a text box that changes from day to day. An example of this would be where the name of the user is manually typed in after using the datbase,...
1
by: meganrobertson22 | last post by:
hi everybody- what is the best way to add data from one form to another? i have 2 tables: person and contract. here are some of the fields. table: person personid (autonumber and primary...
3
by: ILCSP | last post by:
Heello, I'm using Access 2000. I have a form with a combo box that has a query as its row source and it's bound to column 1. This combo box is unbound to a record like the rest of the form...
1
by: imwhiteandnerdy | last post by:
i'm hoping I can get some help with adding my combo box selection to my access database.Any Help would be appreciated. I've been told I need complex binding Basically I just want to add the...
0
by: vljones | last post by:
Hoping to find a way of entering new data into a combo box which contains a list of items contained in a table. In addition I want to allocate an ID number to entries that are not currently in...
2
beacon
by: beacon | last post by:
Hi everybody, I've searched and searched for the answers to these questions until I've turned blue in the face, so I finally decided to come here for some assistance. Here's the info I'm...
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
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...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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
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...

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.