I tried the following code for my requirement but i am getting an error when ENTER key is pressed.
Run-time error: 400
form already open. cannot open it modally.
What should be done???
Private Sub txtProd_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtProd_LostFocus
End If
End Sub
Private Sub txtProd_LostFocus()
If txtProd.Text <> "" Then
If IsNumeric(txtProd.Text) = True Then
MsgBox "if"
var = lstSrno.ListCount + 1
Call Connection
Set rs = New ADODB.Recordset
rs.Open "Select * from Products where Prod_Code=" & Val(txtProd.Text) & "", con, 3, 3
lstSrno.AddItem (var)
lstProd.AddItem (txtProd.Text)
lstDescrptn.AddItem (rs!Prod_Name)
lstStax.AddItem (rs!ST)
con.Close
txtProd.Locked = True
txtQty.SetFocus
Else
MsgBox "else"
frmValidNo.Show vbModal
With txtProd
.Text = ""
.SetFocus
End With
End If
Else
frmValid.Show vbModal
With txtProd
.Text = ""
.SetFocus
End With
End If
End Sub
See this code:
Private Sub Form_Load()
Text1.TabStop = False
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 9 Then
MsgBox "TAB Key is Pressed"
End If
End Sub
I think, u can easily understand, wht have to do. Set the
TabStop Property of the TextBox
txtProd to
False. Then u can get ur result.
If u r succeed, reply me.
Get Better.
Regards,
shuvo2k6