i want a particlular calculation at the press of tab key i am using the following code but as i press the tab the cursor moves to the next text box but calculation is not done
tell me what to do


VB Code:
  1. Private Sub Text17_KeyPress(KeyAscii As Integer)
  2. If KeyAscii = 9 Then
  3. Dim objConn As ADODB.Connection
  4. Set objConn = New ADODB.Connection
  5. objConn.Open ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\database\DB.mdb;Persist Security Info=False")
  6.  
  7.  
  8. Text18.Text = Text17.Text * Text14
  9.  
  10. Dim q As String
  11. q = "Select * from product where pname='" & Text24.Text & "'"
  12. Set rs2 = objConn.Execute(q)
  13. Text99 = rs2("pcs") & ""
  14. Text15 = Text17.Text \ Text99.Text & " "
  15. Dim a As Integer
  16. a = Text15 * rs2("pcs")
  17. Dim b As Integer
  18. b = Text17 - a
  19. Dim c As Double
  20. c = b / rs2("pcs(box)")
  21. Text3.Text = c
  22. Dim d As Integer
  23.  
  24. 'MsgBox (c)
  25. End If