It works in Debug...

G

grep

I wrote a function which just increments or decrements a field, if you
hit "+" or "-" (a la Quickbooks/Quicken). When I run it in debug, it
works perfectly. When I turn off debug, however, it stops working.
Here's the function:

Public Function PlusMinus(FieldVal As Integer, Key As Integer)
'Increments/Decrements value based on + or - keys
If Key = 43 Then
PlusMinus = FieldVal + 1
ElseIf Key = 45 Then
PlusMinus = FieldVal - 1
Else: PlusMinus = FieldVal
End If

End Function

Here's the call from a field's OnKeypress Event:

Private Sub Grade_KeyPress(KeyAscii As Integer)
'Increment/Decrement Grade
Grade = PlusMinus(Grade, KeyAscii)

End Sub

Any suggestions?

grep
 
G

grep

FYI, I discovered that it doesn't really work the way I intended it to
anyway, but I'm still curious as to why it did one thing in debug, and
another when not.

grep
 

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