I have written an event procedure for after the cost combo box is selected
that if the value is NOT equal to 0 I do not want the field truckhours to be
able to be input and if it is 0 they truck hours can be input.
Private Sub cbocost_AfterUpdate()
If (Me.cost) <> 0 Then
Me.TruckHours1.Enabled = False
Else
Me.TruckHours1.Enabled = True
End If
End Sub
not sure what I have wrong
thanks,
Barb
Douglas J. Steele - 17 Mar 2008 22:38 GMT
It would help to know the exact error message you're getting.
However, you imply that decision is based on what was selected in the combo
box. In one place, the combo box is called cbocost, in the other, it's
simply cost. Try changing
If (Me.cost) <> 0 Then
to
If (Me.cbocost) <> 0 Then

Signature
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
>I have written an event procedure for after the cost combo box is selected
> that if the value is NOT equal to 0 I do not want the field truckhours to
[quoted text clipped - 12 lines]
> thanks,
> Barb
Beetle - 17 Mar 2008 22:40 GMT
The name of your combo box appears to be cbocost, so it would need
to be;
Private Sub cbocost_AfterUpdate()
If (Me.cbocost) <> 0 Then
Me.TruckHours1.Enabled = False
Else
Me.TruckHours1.Enabled = True
End If
End Sub

Signature
_________
Sean Bailey
> I have written an event procedure for after the cost combo box is selected
> that if the value is NOT equal to 0 I do not want the field truckhours to be
[quoted text clipped - 11 lines]
> thanks,
> Barb