change access from from "unbound" to "bound"

I have a simple table in access database.
All I wan is to make one text box populated using drop down. For example.

My table
ID           County no                 County Name
1               1                                 area 1
2              2                                  area 2

My Form

County no                         "DROP DOWN"
Count Name                     "TEXT BOX 1"


I want text box to be filled out when I select the number in drop down.

Thank you much in advance for all your help.
AiyshaAsked:
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.

Rey Obrero (Capricorn1)Commented:
first set the Column Count property of the combo box to 3

Column Count  3


in the afterUpdate Event of the combo box, place this code

me.[TEXT BOX 1]= me.[DROP DOWN].column(2)



.[TEXT BOX 1] is assumed to be the name of the text box and
[DROP DOWN] is assumed to be the name of the combo box

if those are not true, change them accordingly

.
0
AiyshaAuthor Commented:
Rey,
Thank you for your response. I get the error with the pop up window when I make the suggested changes and run my form

"Microsoft Access cannot find the object "me."

Please help
0
Rey Obrero (Capricorn1)Commented:
where did you place the codes?

post them here...
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.

PatHartmanCommented:
There is no reason to store the country name but there are reasons for displaying both the country number and the name.  A simple, no code solution is to concatenate the country number and name in the query used as the combo's RowSource.

Select ID, [country no] & " - " & [country name] As CountryName From Your table
Order By [country no] & " - " & [country name];

Or, If you prefer country name first order then:
Select ID, [country name] & " - " & [country no] As CountryName From Your table
Order By [country name] & " - " & [country no];

I've attached a database with a sample that explains three methods of populating form fields from lookup values and when you should choose each technique.
FillFormFields130127.zip
0
AiyshaAuthor Commented:
PatHartman,

I really appreciate details in he dataset you uploaded. I am really new to access though a very old VBA programmer in excel.

Using responses on this question I have setup the form in attached database. However the operator field still does not get populated. Further problem is there are repeated operators and if I use distinct query then I lost connection with County combo box..any suggestions please?
TEXAS_LD---Copy.zip
0
Rey Obrero (Capricorn1)Commented:
test this

post back your comments
TEXAS_LD---revised.zip
0
AiyshaAuthor Commented:
thank you so much. I got that working now I am trying to fill out the textboxes and below is the code the does not work

Me.combo_operator = ""
Me.combo_operator.RowSource = "SELECT DISTINCT Permits.[Operator Name]" _
                            & " FROM Permits" _
                            & " WHERE(Permits.County) = '" & Me.Combo_county & "'"

-->    Me.Txt_District.Text = "SELECT Permits.District FROM Permits WHERE(Permits.County) ='" & Me.Combo_county & "'"
0
Rey Obrero (Capricorn1)Commented:
try this


Private Sub Combo_county_AfterUpdate()
Me.combo_operator = ""
Me.combo_operator.RowSource = "SELECT DISTINCT Permits.[Operator Name]" _
                            & " FROM Permits" _
                            & " WHERE(Permits.County) = '" & Me.Combo_county & "'"



Me.Txt_District = DLookup("District", "Permits", "County = '" & Me.Combo_county & "'")
End Sub
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
AiyshaAuthor Commented:
Very related to what I have been doing Rey can you please also show me how to fill list box with few fields from table and is exporting the list box into excel a completely different module?

thank you,
Aiysha.
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.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.