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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AfterUpdate event woes...

Status
Not open for further replies.

st4rcutter

Technical User
Apr 26, 2006
10
US
I'm having trouble applying some of the other posts on this issue to mine so I am posting this...

I have a simple simple form with a combo box and a textbox. Let's define them as:

form = "projects"
combobox = "media"
textbox = "cost"

The Combobox is setup to lookup values from another table called "mediacosts". This table is setup like this:

Media type Costs
CDROM $2
DVD-ROM $5

The goal is to have the textbox field automatically update when a value is chosen in the combo box. I have done the following based on other posts:

1.) Set the Control Source of the textbox to: =Forms![projects]!Media type.

2.)I recorded a macro under the Onclick event to requery the textbox "cost".

The next step is to create an AfterUpdate event to set the new value. I have this:

Me!cost = Me!media.Column(1)

When I run the macro it tells me 'Error 2448, you can't assign a value to this object'. Where am I missing the boat?

 
Let me clarify by stating that the Control Source line should read:

=Forms![projects]!media and the AfterUpdate is: Me!cost = Me!media.Column(1).

Thanks!
 
I think you can leave out the macro, and simply add the code in the afterupdate-event of the combox.

Private Sub Media_AfterUpdate()
Me!Cost = Me.Media.Column(1)
End Sub



Pampers [afro]
Just back from holiday...
that may it explain it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top