473,387 Members | 1,517 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,387 software developers and data experts.

Updating table from a form

7
I am working in Access 2003. I have a form that pulls information from a couple of tables. When the user chooses a selection from the dropdown menu of a combo box, it is putting that information back in to the table as a duplicate of a record that is already there. (Example - a field has 3 choices - good, fair, stable - after using it a couple of times and choosing good, would now have good in the drop down menu several times). I only want the results from that combo box choice to update to a record.
The record source for the form shows a SELECT statement of all the fields. I have the row source of the combo box pulling from the table with a SELECT statement. Since I know the Control Source is the field that should be updating back to a table, I have tried setting it several different way, but it seems no matter how I set it, it still updates the original table. I only want it to update to a record.
I don't know if this is explained well enough or enough information included, but if someone can point me at what I should be looking at to fix this, I would appreciate it.
Feb 27 '08 #1
4 1579
Minion
108 Expert 100+
I am working in Access 2003. I have a form that pulls information from a couple of tables. When the user chooses a selection from the dropdown menu of a combo box, it is putting that information back in to the table as a duplicate of a record that is already there. (Example - a field has 3 choices - good, fair, stable - after using it a couple of times and choosing good, would now have good in the drop down menu several times). I only want the results from that combo box choice to update to a record.
The record source for the form shows a SELECT statement of all the fields. I have the row source of the combo box pulling from the table with a SELECT statement. Since I know the Control Source is the field that should be updating back to a table, I have tried setting it several different way, but it seems no matter how I set it, it still updates the original table. I only want it to update to a record.
I don't know if this is explained well enough or enough information included, but if someone can point me at what I should be looking at to fix this, I would appreciate it.
Light, I hate to have to say this, but this is a jumbled mess that makes little to no sense. So, let's try and get some facts ironed out so we can try and track your problem.

1. You said the form's record source is a SELECT statement that pulls from your various tables. Ok, well you'll want to post that so we can see where you're getting your information.

2. You mentioned that when a value is selected from the combo box it appears multiple times in the box. Well two parts to this. First, where is the combo box getting it's information. Post the statement. Second, to what table (if any) is the combo box bound? Luckily this part may be fixed by adding one or two words, but we need to know what you using now.

3. What is the overall objective of what you are trying to do? We can't help you get there unless we know where you're headed.

- Minion -
Feb 27 '08 #2
I think you are describing two separate problems. For the combobox, try simply changing your SELECT statement to a SELECT DISTINCT (everything else remains the same. I don't understand the difference between updating a table and updating a record.
Feb 28 '08 #3
Without looking at the structure, here is what I think:
You should have a main table with uniquely identifying information, and a bunch of foreign keys from other tables of repetitive information. Say that you have a small table "tblCondition" with two fields, "ID" and "strCondition". Your table looks like this:

tblCondition
________________

ID strCondition
____ _______________

1 Good
2 Fair
3 Stable

Now in your table tblMain, you should have ID, lngSerialNumber, strSpecificInformation, strMoreSpecificInformation, fkGenericInformation, fkConditionID, etc...
fkConditionID is just a Number, in this case, 1, 2, or 3. Your Combobox should lookup and display the values in tblCondition.strCondition and show those to the user, but should update the corresponding value from tblCondition.ID in tblMain.fkConditionID.

Of course, your form should also look to tblCondition.strCondition for what to display in records in the form.

OR, if you can't normalize the tables, just keep "Condition" (or whatever it is actually called) in tblMain (or whatever it is called), but have the combobox draw its info from a SELECT DISTINCT on tblMain.Condition. But this is asking for trouble.

OTOH, I'm no expert.
Feb 28 '08 #4
Light1
7
Sorry, I am completely new to Access other than classes about 6 or 7 years ago. This is the first project for me and I really did not know how much was needed to report this problem.

Overall Objective: I work for a small hospital. Our ER department is still manually writing down their information in a log book and they want to automate it. They do have a registration desk that keeps track of patient information and that is already automated. This is just for their personal department to track. They just want to keep general records of how many people they see, what type of problems are coming in to them and if any of the patients seen are repeated withing 72 hours. I created the form with the form wizard. There are a couple of tables that need to be updated when new information is used, and a couple that simply need to be used without updating. The overall table that needs to track data from all the table is a ServiceRecord table.

Here is the SELECT statement from my form:

SELECT tblServiceRecords.ServiceRecordID, tblServiceRecords.DateAdmitted, tblServiceRecords.TimeAdmitted, tblServiceRecords.[Time of Triage], tblServiceRecords.NatureOfInjury, tblServiceRecords.ServiceRendered, tblServiceRecords.Infection, tblServiceRecords.AlcoholRelated, tblServiceRecords.DrugAbuse, tblServiceRecords.PhysicalAbuse, tblServiceRecords.DismissalDate, tblServiceRecords.DismissalTime, tblServiceRecords.MedicalRecordNumber AS tblServiceRecords_MedicalRecordNumber, tblServiceRecords.TimeSeenByPhysician, tblPatientInformation.MedicalRecordNumber AS tblPatientInformation_MedicalRecordNumber, tblPatientInformation.FirstName AS tblPatientInformation_FirstName, tblPatientInformation.LastName AS tblPatientInformation_LastName, tblPatientInformation.Address, tblPatientInformation.City, tblPatientInformation.State, tblPatientInformation.ZipCode, tblPatientInformation.Birthdate, tblPatientInformation.Sex, tblAdmittingNurse.FirstName AS tblAdmittingNurse_FirstName, tblAdmittingNurse.LastName AS tblAdmittingNurse_LastName, tblPhysicianAttending.FirstName AS tblPhysicianAttending_FirstName, tblPhysicianAttending.LastName AS tblPhysicianAttending_LastName, tblFamilyPhysician.FirstName AS tblFamilyPhysician_FirstName, tblFamilyPhysician.LastName AS tblFamilyPhysician_LastName, tblCondition.strCondition, tblDisposition.Disposition, tblInstructed.Instructed, tblModeOfArrival.ModeOfArrival, tblTypeOfInjury.TypeOfInjury, tblServiceRecords.AdmittingNurseID, tblServiceRecords.AttendingPhysicianID, tblServiceRecords.FamilyPhysicianID, tblServiceRecords.ConditionID, tblServiceRecords.DispositionID, tblServiceRecords.InstructedID, tblServiceRecords.ModeOfArrivalID, tblServiceRecords.TypeOfInjuryID, tblServiceRecords.DeadOnArrival, tblServiceRecords.SurgeryER, tblServiceRecords.LocalStitches, tblServiceRecords.Infection, tblServiceRecords.AlcoholRelated, tblServiceRecords.DrugAbuse, tblServiceRecords.PhysicalAbuse, tblServiceRecords.Closed, tblServiceRecords.ExamTime, tblServiceRecords.[Room Number], tblServiceRecords.[Account Number], tblPatientInformation.MedicalRecordNumber
FROM tblPatientInformation LEFT JOIN (tblTypeOfInjury RIGHT JOIN (tblPhysicianAttending RIGHT JOIN (tblModeOfArrival RIGHT JOIN (tblInstructed RIGHT JOIN (tblFamilyPhysician RIGHT JOIN (tblDisposition RIGHT JOIN (tblCondition RIGHT JOIN (tblAdmittingNurse RIGHT JOIN tblServiceRecords ON tblAdmittingNurse.AdmittingNurseID = tblServiceRecords.AdmittingNurseID) ON tblCondition.ConditionID = tblServiceRecords.ConditionID) ON tblDisposition.DispositionID = tblServiceRecords.DispositionID) ON tblFamilyPhysician.FamilyPhysicianID = tblServiceRecords.FamilyPhysicianID) ON tblInstructed.InstructedID = tblServiceRecords.InstructedID) ON tblModeOfArrival.ModeOfArrivalID = tblServiceRecords.ModeOfArrivalID) ON tblPhysicianAttending.AttendingPhysicianID = tblServiceRecords.AttendingPhysicianID) ON tblTypeOfInjury.TypeOfInjuryID = tblServiceRecords.TypeOfInjuryID) ON tblPatientInformation.MedicalRecordNumber = tblServiceRecords.MedicalRecordNumber;

The easiest combo box I have pulls from an Instructed table (2 fields - InstructedID and Instructed). It should only have 2 records - Yes, or No. Here is the code I have in the Row Source:

SELECT tblInstructed.instructed FROM tblinstructed;

If I put in 'Instructed' in the Control Source, it updates both the Instructed table and the ServiceRecords table. I only want it to update the ServiceRecords table showing what answer the user chose - not keep putting the choice back in the Instructed table. I have tried several different ways and am getting no where.

I also have a combo box that pulls from a table AdmittingNurse. This table has 3 fields - AdmittingNurseID, FirstName and LastName. Here is the code I have in the Row Source for AdmittingNurse:

SELECT tbladmittingnurse.firstname & " " & tbladmittingnurse.lastname FROM tbladmittingnurse;

I want this combo box to do the same as the Intructed one - just update to the ServiceRecord with their answer.

I have a lot to learn, so if you know of books, etc. that would be of good help, please feel free to suggest it. I do like this site. I have found help here already.

Just a note to the other reply I had. If I try and put in tblServiceRecords.strCondition as the Control Source, I get the error 'The value you entered isn't valid for this field. For Example, you may have entered text in a numeric field or a number that is larger than the FieldSize settings permit. I did check my tables and did not find what was causing this error.

Thanks for any help you can provide.


Light, I hate to have to say this, but this is a jumbled mess that makes little to no sense. So, let's try and get some facts ironed out so we can try and track your problem.

1. You said the form's record source is a SELECT statement that pulls from your various tables. Ok, well you'll want to post that so we can see where you're getting your information.

2. You mentioned that when a value is selected from the combo box it appears multiple times in the box. Well two parts to this. First, where is the combo box getting it's information. Post the statement. Second, to what table (if any) is the combo box bound? Luckily this part may be fixed by adding one or two words, but we need to know what you using now.

3. What is the overall objective of what you are trying to do? We can't help you get there unless we know where you're headed.

- Minion -
Mar 3 '08 #5

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

Similar topics

3
by: | last post by:
Hello, Sorry to ask what is probably a simple answer, but I am having problems updating a table/database from a PHP/ PHTML file. I can Read From the Table, I can Insert into Table/Database, But...
11
by: Jason | last post by:
Let's say I have an html form with 20 or 30 fields in it. The form submits the fields via POST to a php page which updates a table in a database with the $_POST vars. Which makes more sense? ...
1
by: Derek Davlut | last post by:
I have a Table that contains data that I use in a query to manipulte the data through expressions. I have a form that uses the query for manipulating the data. How do I write the changed values...
10
by: jaYPee | last post by:
does anyone experienced slowness when updating a dataset using AcceptChanges? when calling this code it takes many seconds to update the database SqlDataAdapter1.Update(DsStudentCourse1)...
6
by: Dave | last post by:
I want to put the information that the user selects in my combo boxes into a subform that lies on the same form as the combo boxes. Thanks for your help already, Dave
3
by: Spoogledrummer | last post by:
Hi it's me again, still working on the sam 5 minute problem so feeling kind of thick now. I've dumped the idea of using a textarea for now and am using a textbox instead but am struggling when it...
9
by: hrreece | last post by:
I have an Access 2002 database that has a form that can be used to review individual records. At the bottom of the form are buttons that are linked to functions that allow the user to "Find a record...
5
stepterr
by: stepterr | last post by:
I have a form that is built based on a query. Everything is working except when I submit the form the radio buttons are only updating the first row in my database. dcategory and dthumbnail are two...
4
by: AlexNunley | last post by:
I've adopted a moderately sized (65k records) active use database (Access 2000, Windows XP). One of the most commonly used forms is whats called the RMA generation field, used to add claim...
2
by: =?Utf-8?B?VmFuZXNzYQ==?= | last post by:
Hi All! I am with a situation where I am not getting the right updating to the form's fields. The situation is the following one: I have one combobox and one textbox. I am using the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
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
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...

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.