Select case

  • Thread starter Thread starter Pawdnos
  • Start date Start date
P

Pawdnos

Private Sub ChargeTo_AfterUpdate()
Hello,

Help! Help! When I run this select code - suppose I select Clone from the
combo box chargeTo it puts the total on every record that exist in the
database instead of just for the selected current record. Please help. Thanks
a million.

Select Case ChargeTo
Case "Clone", "Audio"
Me.Total = ProjectTotal] + [Custom] + [Devlivery] + [CorpCost]
Case Else
Me.Total = ProjectTotal] + [Custom] + [Devlivery] End Select
 
Pawdnos,
That's because Total is not a "bound" field (bound to a field in your
table).
There is no table field indicated in the ControlSource.

I think you need a calculated field, with a ControlSource of... all on
one line
=IIF([ChargeTo] = "Clone" or [ChargeTo] = "Audio", [ProjectTotal] + [Custom]
+ [Devlivery] + [CorpCost], [ProjectTotal] + [Custom] + [Devlivery])

This will evaluate the ChargeTo value on each record, and react
accordingly.

--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
Back
Top