By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,476 Members | 1,529 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,476 IT Pros & Developers. It's quick & easy.

Copying info from a combo box

P: 26
I have a form which tracks patient information. It has patient id, last name, first name etc as well as a field called Condition. The form also has a combo box called DraftCondition which is driven by a separate table called TblDraftCondition.

What I want the user to be able to do is create a record, select a DraftCondition and then when we have confirmation of the Condition, update the record by copying the DraftCondition to the Condition. To make life easier and prevent data entry errors, I created a macro which uses the SetValue function to copy the DraftCondition into the Condition field. However, the macro copies the DraftConditionID (number) and not the DraftCondition (text).

I can't figure out why it does this and the only way I can think to solve it is to remove the DraftConditonID as the primary key (done by Autonumber) and just have the DraftCondition as the primary key. But I know that I don't really know much about Access and am fearful of deviating from the norm in case I really muck things up. Any suggestions would be really, really appreciated!
Oct 29 '08 #1
Share this Question
Share on Google+
4 Replies


DonRayner
Expert 100+
P: 489
I have a form which tracks patient information. It has patient id, last name, first name etc as well as a field called Condition. The form also has a combo box called DraftCondition which is driven by a separate table called TblDraftCondition.

What I want the user to be able to do is create a record, select a DraftCondition and then when we have confirmation of the Condition, update the record by copying the DraftCondition to the Condition. To make life easier and prevent data entry errors, I created a macro which uses the SetValue function to copy the DraftCondition into the Condition field. However, the macro copies the DraftConditionID (number) and not the DraftCondition (text).

I can't figure out why it does this and the only way I can think to solve it is to remove the DraftConditonID as the primary key (done by Autonumber) and just have the DraftCondition as the primary key. But I know that I don't really know much about Access and am fearful of deviating from the norm in case I really muck things up. Any suggestions would be really, really appreciated!
If your DraftConditionID is the first field in the table and your bound column is set to 1 then thats what information you will get. In the combobox properties change the bound column number to the column with the text.

Don
Oct 29 '08 #2

P: 26
I can't believe it was that simple.
I changed the column count and it copied the text but now the combo box selection doesn't stay the same for the record. So, on record 1 if I select 'Coma', and then go to the 2nd record and select 'sleep apnea', when I go back to record 1, the DraftCondition reads 'sleep apnea'. I need the DraftCondition to reflect what the user selects because it could be days or months before we figure out what the Condition is.

Thanks!
Oct 29 '08 #3

DonRayner
Expert 100+
P: 489
I can't believe it was that simple.
I changed the column count and it copied the text but now the combo box selection doesn't stay the same for the record. So, on record 1 if I select 'Coma', and then go to the 2nd record and select 'sleep apnea', when I go back to record 1, the DraftCondition reads 'sleep apnea'. I need the DraftCondition to reflect what the user selects because it could be days or months before we figure out what the Condition is.

Thanks!
If it's an unbound combobox then it will only show what has been currently selected indepndant from the forms recordsource. If you want the value retained between records it will have to be bound to the table in some manner.
Oct 29 '08 #4

missinglinq
Expert 2.5K+
P: 3,532
As Don said, you'll have to have a field in your underlying table to hold the data selected for Draft Condiditon. If your form is based on a query, you'll need to go into the Query Design Grid and add this field to the query. Now, in Design View for your form, right click on the combobox, select Properties then goto the Data tab, and in the Control Source property select this new field. Now when you move between records the appropriate initial diagnosis will be maintained.

Linq ;0)>
Oct 29 '08 #5

Post your reply

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