Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DATA FROM ONE CONTROL TO ANOTHER 1

Status
Not open for further replies.

Kevsim

Instructor
Apr 18, 2000
385
AU
I have a form called “Component”, with combo and text boxes associated with the table, except for one combo box which displays from a list that is not associated with the table. After I select an item from the list combo box, how can I copy this item to an associated text box on the form? Or how can I make this an entry directly into the table. I would prefer to use Visual Basic.
Any advise would be appreciated.
kevsim

 
Kevin,
Add the following code to the AfterUpdate event of the form:

Private Sub cmbYourComboControl_AfterUpdate()
Dim F As Form: Set F = Me
F!txtYourTextControl = F!cmbYourComboControl
End Sub

Rename the controls and the event name to be consistent with your form's control names.

Note that the AfterUpdate event is triggered after the user has selected a value from the pulldown list.

Make sure that the text control on the form is bound to a text field in the underlying table.

If your combo box has more than a single column, and you wish to assign a value other than the first column to the text box, then use the following syntax:

F!txtYourTextControl = F!cmbYourComboControl.column(1)

Note however that the column property is 'zero based'; ie. the (1) above represents the second column; (2) would represent the third etc.

Hoping this helps,


Cheers,

Steve Lewy
Solutions Developer
steve@lewycomputing.com.au
 
Kevin,
I've answered this in your other post. Its better not to repeat the same question in multiple forums. Cheers,

Steve Lewy
Solutions Developer
steve@lewycomputing.com.au
 
Well, looks like I stuffed up in the post above; Silly me! Cheers,

Steve Lewy
Solutions Developer
steve@lewycomputing.com.au
 
Steve101
Thank you for the info it worked OK. I do not remember you answering this query before as I had not posed before.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top