|
-
Apr 29th, 2006, 11:25 AM
#1
Thread Starter
Member
[RESOLVED] Set value of Textbox from a combo box column
I am trying to set the value of a textbox named "Address" by referencing the value of column 1 of a combo box named "Location". The following code is not working for me. Please help
Private Sub Location_Change()
Address.Value = Location.Column(1)
End Sub
I have also tried the following code..
Private Sub Location_Change()
Address.Value = [Form]![Location].[Column](1)
End Sub
[Resolution:
Private Sub Location_Change()
Address.Value = Location.Column(1, Location.ListIndex)
End Sub
Thank You "bushmobile"
carbo
Last edited by carbo; Apr 29th, 2006 at 03:00 PM.
-
Apr 29th, 2006, 12:28 PM
#2
Re: Set value of Textbox from a combo box column
Perhaps something like this
VB Code:
Private Sub ComboBox1_Click()
Debug.Print ComboBox1.Column(1, ComboBox1.ListIndex)
End Sub
Since you're talking about columns in a ComboBox I'm assuming your either using VBA within an Office application, or you've referenced Microsoft Forms 2.0 Object Library. If it is the latter then you should know that library is non-redistributable and you would not be able to package it with your application. Your end-users would have to already have MSOffice installed on their machines. There is a way around it by getting them to download some other application that is free (can't remember the name) but generally the controls in that dll are avoided. See MSDN for more info.
-
Apr 29th, 2006, 12:40 PM
#3
Lively Member
Re: Set value of Textbox from a combo box column
Sorry, but hat do u mean by " set the value of a textbox named "Address" by referencing the value of column 1 of a combo box named "Location" ".Can u explain more?
I'm Still learning!
satisfied/not satisfied, PLEASE TAKE SOME TIME TO rate me accordingly.
Ur opinions helps me to be better!
Appreciation Triggers Another Good Deeds.
-
Apr 29th, 2006, 01:13 PM
#4
Thread Starter
Member
Re: Set value of Textbox from a combo box column
The combo box contains not only the place name i.e. "Wal-Mart" but also in column 1 contains the address. So while the value for "Location" (combo box) will be "Wal-Mart" the next field is for the actual address of "Wal-Mart" which is stored in column 1, So when I select "Wal-Mart" from the combo box i would like for it to pass the address value of the next field "Address" to that field on an "on change" event.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|