I have very strange problem in VBA. I'm trying to compare 2 values, one is varible assigned from table (AfterUpdate event on ComboBox), and other one is value that user type in textbox on form.
nosivost = DLookup("max_nosivost", "tbl_vozila", "[registarska_oznaka]='" & Me.vozilo.Column(2) & "'")
If nosivost < Me.kolicina Then MsgBox "Some text", vbCritical, "Title"
Me.vozilo is name of ComboBox that displays records from tbl_vozila. Me.kolicina is name of TextBox.
The problem is that I'm getting MsgBox every time, even if the If-Then statement is not true. For example, If I type 10 in TextBox and select record from ComboBox which have max_nosivost = 30 I would still get MsgBox.
I checked value of variable "nosivost" and DLookup is returning correct value.
Aucun commentaire:
Enregistrer un commentaire