ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Text Box Updating (https://www.excelbanter.com/excel-programming/437556-text-box-updating.html)

Brian

Text Box Updating
 
I am having trouble getting a text box to auto fill from a choice made from a
combo box.

Combo Box Name is Address_21
Text Box Name is City_1

My code is as follows:

'Auto Fill CES Spec Written Office

Private Sub Address_21_Change()

Select Case Address_21
Case ""2306 Long Green Court"
City_1 = "Valrico"
Case ""3440 Oakcliff Road"
City_1 = "Atlanta"
Case "7015 East 14th Aveneue"
City_1 = "Tampa"
Case "1800 Taylor Drive"
City_1 = "Gastonia"
End Select

End Sub

Can someone help me figure out what I did incorrectly?



Mike

Text Box Updating
 
Try this
Private Sub Address_21_Change()

Select Case Address_21
Case ""2306 Long Green Court"
City_1.Value = "Valrico"
Case ""3440 Oakcliff Road"
City_1.Value = "Atlanta"
Case "7015 East 14th Aveneue"
City_1.Value = "Tampa"
Case "1800 Taylor Drive"
City_1.Value = "Gastonia"
End Select

End Sub


"Brian" wrote:

I am having trouble getting a text box to auto fill from a choice made from a
combo box.

Combo Box Name is Address_21
Text Box Name is City_1

My code is as follows:

'Auto Fill CES Spec Written Office

Private Sub Address_21_Change()

Select Case Address_21
Case ""2306 Long Green Court"
City_1 = "Valrico"
Case ""3440 Oakcliff Road"
City_1 = "Atlanta"
Case "7015 East 14th Aveneue"
City_1 = "Tampa"
Case "1800 Taylor Drive"
City_1 = "Gastonia"
End Select

End Sub

Can someone help me figure out what I did incorrectly?



Ryan H

Text Box Updating
 
You might have one of the elements of the combobox spelled wrong. I
personally like to you the .ListIndex property instead to avoid this problem.
For example,

Private Sub Address_21_Change()

Select Case Me.Address_21.ListIndex
Case Is = 0: Me.City_1 = "Valrico" '2306 Long Green Court
Case Is = 1: Me.City_1 = "Atlanta" '3440 Oakcliff Road
Case Is = 2: Me.City_1 = "Tampa" '7015 East 14th Aveneue
Case Is = 3: Me.City_1 = "Gastonia" '1800 Taylor Drive
End Select

End Sub


Hope this helps! If so, let me know, click "YES" below.
--
Cheers,
Ryan


"Brian" wrote:

I am having trouble getting a text box to auto fill from a choice made from a
combo box.

Combo Box Name is Address_21
Text Box Name is City_1

My code is as follows:

'Auto Fill CES Spec Written Office

Private Sub Address_21_Change()

Select Case Address_21
Case ""2306 Long Green Court"
City_1 = "Valrico"
Case ""3440 Oakcliff Road"
City_1 = "Atlanta"
Case "7015 East 14th Aveneue"
City_1 = "Tampa"
Case "1800 Taylor Drive"
City_1 = "Gastonia"
End Select

End Sub

Can someone help me figure out what I did incorrectly?



John

Text Box Updating
 
see if this change to your code helps:

Private Sub Address_21_Change()

With Me

Select Case .Address_21.Text

Case "2306 Long Green Court"

.City_1.Text = "Valrico"

Case "3440 Oakcliff Road"

.City_1.Text = "Atlanta"

Case "7015 East 14th Aveneue"

.City_1.Text = "Tampa"

Case "1800 Taylor Drive"

.City_1.Text = "Gastonia"

End Select

End With

End Sub
--
jb


"Brian" wrote:

I am having trouble getting a text box to auto fill from a choice made from a
combo box.

Combo Box Name is Address_21
Text Box Name is City_1

My code is as follows:

'Auto Fill CES Spec Written Office

Private Sub Address_21_Change()

Select Case Address_21
Case ""2306 Long Green Court"
City_1 = "Valrico"
Case ""3440 Oakcliff Road"
City_1 = "Atlanta"
Case "7015 East 14th Aveneue"
City_1 = "Tampa"
Case "1800 Taylor Drive"
City_1 = "Gastonia"
End Select

End Sub

Can someone help me figure out what I did incorrectly?



Brian

Text Box Updating
 
Works perfectly

Thanks

"Mike" wrote:

Try this
Private Sub Address_21_Change()

Select Case Address_21
Case ""2306 Long Green Court"
City_1.Value = "Valrico"
Case ""3440 Oakcliff Road"
City_1.Value = "Atlanta"
Case "7015 East 14th Aveneue"
City_1.Value = "Tampa"
Case "1800 Taylor Drive"
City_1.Value = "Gastonia"
End Select

End Sub


"Brian" wrote:

I am having trouble getting a text box to auto fill from a choice made from a
combo box.

Combo Box Name is Address_21
Text Box Name is City_1

My code is as follows:

'Auto Fill CES Spec Written Office

Private Sub Address_21_Change()

Select Case Address_21
Case ""2306 Long Green Court"
City_1 = "Valrico"
Case ""3440 Oakcliff Road"
City_1 = "Atlanta"
Case "7015 East 14th Aveneue"
City_1 = "Tampa"
Case "1800 Taylor Drive"
City_1 = "Gastonia"
End Select

End Sub

Can someone help me figure out what I did incorrectly?




All times are GMT +1. The time now is 10:03 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com