Skiping code?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Ok this is a good one. I have a drop box that get the Manufacturer part
number from a table, it then populates a set of fields using the AfterUpdate
event. I want to display a warning to the user that tells them if the
quantity ordered is greater than the quantity quoted. I basically enable a
box is the condition is true. This code only seems to work if i put a break
on the IF statement to debug it, when I remove the break, then it doesnt
work. Any Ideas? Here is the code im using.

Private Sub ManufPartNumbr_AfterUpdate()

Me.Description.Value = Me.ManufPartNumbr.Column(1)
Me.Cost.Value = Me.ManufPartNumbr.Column(2)
Me.txtqtyquoted.Value = Me.ManufPartNumbr.Column(3)


If Me.txtqtyord.Value > Me.txtqtyquoted.Value Then
Me.qtyWarning.Visible = True
Else
Me.qtyWarning.Visible = False
End If

End Sub
 
the If statement itself looks okay. when you say it "doesn't work", what
happens: do you get an error message? or does the statement always evaluate
to True or always evaluate to False, regardless of what the compared values
are? or...?

using the .Value shouldn't make a difference, but you could try beginning
the If statement with

If Me.txtqtyord > Me.txtqtyquoted Then

alternately, instead of the If statement, you could try

Me.qtyWarning.Visible = (Me.txtqtyord > Me.txtqtyquoted)

hth
 
hmm same result.. looks like the statement always evaluates to False unless I
have a break. I know what the problem is, the qty quoted value comes from a
sub form, so, when the code runs, this value hasnt been calculated yet, so it
is always 0. Im learning as I go here.. any ideas how I should handle this?
 
from the information you've posted, the best i can do is a general
suggestion: determine at what point, in the data entry process, that the
qtyquoted value is calculated. then set up the code to run on some event
that *always occurs*, after that point.

hth
 
Back
Top