Unable to update text box from combo box..

ST4RCUTTER

Registered User.
Local time
Today, 03:01
Joined
Aug 31, 2006
Messages
94
I'm trying to have the user select an item from a combo box which gets its values from a table with multiple columns. Once something is selected in the combo box the form will auto-update the adjacent text box to a value in the same row (different column). The combo box is called 'Media' and the text box is called 'Tape Cost'. When you select a type of tape in the combo box the adjacent text box should populate a value determined by the second column of the table. Instead I'm getting a message that the, "Method or data member is not found" and it highlights the red text below.


Here is the code I'm using:

Private Sub Media_AfterUpdate()
Me.Tape Cost = Media.Column(2)

End Sub


Not sure what I'm doing wrong here. Thanks!
 
Thanks RuralGuy! I will be sure that I avoid spaces. I did update the code as you suggested and the error does not appear. The text box is not updating however. Is there additional VBA I need to add to perform a refresh for that control or something similar?
 
You *do* know that the Column() index is zero based right? You are populating the [Tape Cost] control with the 3rd column from the Media ComboBox. Is that what you want to do?
 
Yes. I am counting from 0. A little baffling. I'm going to try rebuild these controls and start from scratch. Something is preventing this from updating.
 
Does it matter if the control name and the source name is the same? In this example I have a textbox with the name [Tape Cost] and it's source field is also called "Tape Cost".
 
It's always good to name your controls something other than the field name. It doesn't always cause a problem, but frequently it does, if the control is named the same as the field.
 
Access has a *nasty* habit of defaulting the control name to the same name as the field to which it is bound. Then Access gets confused when you try and reference it. I use a naming convention such as this one. It helps Access and me to keep things straight. In your case it could certainly be the source of your issue.
 

Users who are viewing this thread

Back
Top Bottom