Set Combo box default based on contents of a text box

Hi,

I'm trying to set the default value for a combo box based on the content of a text box

I have the default value field set to:
=[txtContractorFullName].[Text]

The combo box says #Error.

Thanks,

Rick

LVL 1
taborrgAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jeffrey CoachmanMIS LiasonCommented:
A "Default value" is defined as the value that is entered when a *New record* is created.
(See the help files on the Default Value property of a combobox)

This is not the same as simply setting some text to display by default in a combobox.

Can you first take a step back and explain in detail your design here and what your ultimate goal is?

(why the text in a combobox need to change based on a textbox value...)
(Why this value is not in the comboboxes row source...?)
...etc

JeffCoachman
0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
Default Value only applies on a New Record. And you need to set the Bound column of the combo box.

What is the Row Source of the combo box?
How many columns?

mx

0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
Also, when ... exactly are you wanting or expecting to set the Default Value ?
It would at least have to be after something was entered into the txtContractorFullName text box.

mx
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

MINDSUPERBCommented:
Rick,

Try to put this on the Control Source Property of your combobox.

=Forms![NameOfYourForm]![txtContractorFullName]

Sincerely,
Ed

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
But why ... would you want a Combo to have that as a control source? I can't think of an instance where a Combo is going to be a calculated control ...?

mx
0
taborrgAuthor Commented:
It's set to 4 rows.  I have the row source as:

SELECT ContractorLastName & ",  " & ContractorFirstName AS ContractorName, ContractorID, ContractorLastName, ContractorFirstName FROM RTABOR_T_Contractors ORDER BY ContractorLastName;

Which gives a nice "LastName, FirstName" for column 0.

On the attached image you can see it.  The form loads with the combo box empty, and two textboxes with name fields filled in.

I would like to not have the two separate name field textboxes, and have the selected (from the parent form) contractor name appear in the combo box.

I hope these two images help to explain it.

Thanks.


 ComboBoxOnLoad ComboBoxOnLoadComboBoxAfter-a-selection.bmp
0
taborrgAuthor Commented:
It works!

Thanks.
0
taborrgAuthor Commented:
Hey Ed,

That worked, but then the combo box wouldn't allow choosing.  It locked up.  So I removed that and put this in the form's On Load.

Me.cboContractors.Value = [Forms]![frmContractorAssignmentEdit]![txtContractorFullName]

Now it works fine.

Thanks again!
0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
"That worked, but then the combo box wouldn't allow choosing.  It locked up.  So I removed that and put this in the form's On Load."

Like I said :-)

So, in reality, the Accepted Answer does not really work ...

mx
0
taborrgAuthor Commented:
Good point.  And I was ready to jump back on the thread when I saw the combo box was locked up.

But it got me close enough to make it the rest of the way on my own, so I'm greatful.

I really appreciate all the help from the EE experts, I wouldn't have been able to do this job without your help.

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.