getting a compile error not sure why

B

babs

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
 
D

Douglas J. Steele

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
 
B

Beetle

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top